Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 5,297 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Set Approval For... | 24010175 | 5 days ago | IN | 0 ETH | 0.00000603 | ||||
| Set Approval For... | 24002394 | 7 days ago | IN | 0 ETH | 0.00004796 | ||||
| Set Approval For... | 23995352 | 8 days ago | IN | 0 ETH | 0.00002725 | ||||
| Set Approval For... | 23893988 | 22 days ago | IN | 0 ETH | 0.00009406 | ||||
| Transfer From | 23884872 | 23 days ago | IN | 0 ETH | 0.00000409 | ||||
| Set Approval For... | 23756827 | 41 days ago | IN | 0 ETH | 0.00000447 | ||||
| Set Approval For... | 23701249 | 49 days ago | IN | 0 ETH | 0.00009604 | ||||
| Set Approval For... | 23698941 | 49 days ago | IN | 0 ETH | 0.00005084 | ||||
| Set Approval For... | 23672129 | 53 days ago | IN | 0 ETH | 0.00009539 | ||||
| Set Approval For... | 23623495 | 60 days ago | IN | 0 ETH | 0.00001031 | ||||
| Set Approval For... | 23615877 | 61 days ago | IN | 0 ETH | 0.00000513 | ||||
| Set Approval For... | 23549314 | 70 days ago | IN | 0 ETH | 0.0001234 | ||||
| Transfer From | 23548042 | 70 days ago | IN | 0 ETH | 0.00011328 | ||||
| Safe Transfer Fr... | 23536090 | 72 days ago | IN | 0 ETH | 0.00010576 | ||||
| Safe Transfer Fr... | 23530442 | 73 days ago | IN | 0 ETH | 0.00001601 | ||||
| Safe Transfer Fr... | 23528916 | 73 days ago | IN | 0 ETH | 0.00002663 | ||||
| Set Approval For... | 23518155 | 74 days ago | IN | 0 ETH | 0.00000922 | ||||
| Set Approval For... | 23512072 | 75 days ago | IN | 0 ETH | 0.00000751 | ||||
| Safe Transfer Fr... | 23507332 | 76 days ago | IN | 0 ETH | 0.0000531 | ||||
| Transfer From | 23497123 | 77 days ago | IN | 0 ETH | 0.00004842 | ||||
| Safe Transfer Fr... | 23484383 | 79 days ago | IN | 0 ETH | 0.00007813 | ||||
| Safe Transfer Fr... | 23481509 | 80 days ago | IN | 0 ETH | 0.00001526 | ||||
| Safe Transfer Fr... | 23473251 | 81 days ago | IN | 0 ETH | 0.00002066 | ||||
| Set Approval For... | 23469964 | 81 days ago | IN | 0 ETH | 0.00027815 | ||||
| Safe Transfer Fr... | 23464834 | 82 days ago | IN | 0 ETH | 0.00001888 |
Latest 1 internal transaction
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 15372107 | 1218 days ago | 123.48 ETH |
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
MenjisWorld
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 11200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
// __ __ _ _ _ __ __ _ _
// | \/ |___ _ _ (_(_( )___ \ \ / ___ _ _| |__| |
// | |\/| / -_| ' \ | | |/(_-< \ \/\/ / _ | '_| / _` |
// |_| |_\___|_||__/ |_| /__/ \_/\_/\___|_| |_\__,_|
// ─────────────── |__/ ────────────┌▄▄┌─────────────────
// ──────────────────────────────────▄██▀▀▀▀█▄───────────────
// ─────────────────────────────────██───┌───▀█▄─────────────
// ───────────┌▄████▓┐──────────────█▄───▀█────██────────────
// ──────────▄█▀────╙█▌─────────────██────╙█▄───██───────────
// ─────────▓█─┌█▀───▀█═────────────▐█─────╙█▄───██──────────
// ────────▐█──█▌─────██─────────────█▌─────╙█╕──╙█▄─────────
// ────────██─╫█──────╫█──╓▄▓██████▓▌█▌──────██───██─────────
// ────────██─▓▌───────██▀▀└─────────█────────▀───▓█─────────
// ────────╫█──────────╙█▄────────────────────────▐█─────────
// ─────────█▌─▐█▀──────▀█────────╓───▄───────────╒█▌────────
// ─────────╙█─██──────╔───▓▀─────╙█▄█╙────────────█▀────────
// ──────────╙██▌──────╟▌╓█─┌▄─────▓█▒──█╕─────────█▌────────
// ───────────▐█▄───────██──█▌────┌███──╫█────────┌█▌────────
// ───────────▐█▒──────╓███─▀█═───█▌─██─╙─────────▐█─────────
// ───────────╒█▌──────█▌─▀█──────█───█▄──────────██─────────
// ────────────██──────█───╙█─────█────▀────────┌██──────────
// ────────────╙█▌─────└───────────────────────▄█▀───────────
// ─────────────╙█▄─────────────────────────┌▄█▀─────────────
// ──────────────╙██▄──────────────────┌╓▄▓██▀───────────────
// ────────────────╙▀██▄▄▄▄▄▄▄▄▄▄▄▄▓▓███▀▀└──────────────────
// ────────────────────└╙╙╙╙▀▀▀╙╙╙╙└─────────────────────────
// ──────────────────────────────────────────────────────────
// ──────────────────────────────────────────────────────────
// ──────────────────────────────────────────────────────────
// cooked by @nftchef ─────────────────────────────────────
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "erc721a/contracts/ERC721A.sol";
//----------------------------------------------------------------------------
// OpenSea proxy
//----------------------------------------------------------------------------
import "./common/ContextMixin.sol";
import "./common/NativeMetaTransaction.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/finance/PaymentSplitter.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract OwnableDelegateProxy {}
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
//----------------------------------------------------------------------------
// Main contract
//----------------------------------------------------------------------------
contract MenjisWorld is
ERC721A,
ContextMixin,
NativeMetaTransaction,
Ownable,
Pausable,
ReentrancyGuard,
VRFConsumerBase,
PaymentSplitter
{
using Strings for uint256;
using ECDSA for bytes32;
uint128 public PUBLIC_SUPPLY = 4900;
uint128 public MAX_SUPPLY = 5000;
uint128 public PUBLIC_MINT_LIMIT = 10;
uint128 public PRICE = 0.05 ether;
bool public publicWalletLimit = true;
bool public isPresale = true;
string public PROVENANCE_HASH; // keccak256
mapping(address => uint256) public mintBalances;
uint256 public tokenOffset;
string internal baseTokenURI;
address[] internal payees;
address internal _SIGNER;
// opensea proxy
address private immutable _proxyRegistryAddress;
// LINK
uint256 internal LINK_FEE;
bytes32 internal LINK_KEY_HASH;
constructor(
string memory _uri,
bytes32 _keyHash,
address _vrfCoordinator,
address _linkToken,
uint256 _linkFee,
address[] memory _payees,
uint256[] memory _shares,
address proxyRegistryAddress
)
payable
ERC721A("MenjisWorld", "MW")
Pausable()
VRFConsumerBase(_vrfCoordinator, _linkToken)
PaymentSplitter(_payees, _shares)
{
_pause();
baseTokenURI = _uri;
payees = _payees;
LINK_KEY_HASH = _keyHash;
LINK_FEE = _linkFee;
_proxyRegistryAddress = proxyRegistryAddress;
}
function purchase(uint256 _quantity) public payable whenNotPaused {
require(!isPresale, "Presale only.");
require(
_quantity <= PUBLIC_MINT_LIMIT,
"Quantity exceeds PUBLIC_MINT_LIMIT"
);
if (publicWalletLimit) {
require(
_quantity + mintBalances[msg.sender] <= PUBLIC_MINT_LIMIT,
"Quantity exceeds per-wallet limit"
);
}
require(_quantity * PRICE <= msg.value, "Not enough minerals");
mint(_quantity);
}
function presalePurchase(
uint256 _quantity,
uint256 _tier,
bytes32 _hash,
bytes memory _signature
) external payable whenNotPaused {
require(
checkHash(_tier, _hash, _signature, _SIGNER),
"PresaleMintNotAllowed"
);
// @dev Presale always enforces a per-wallet limit
require(
_quantity + mintBalances[msg.sender] <= _tier,
"Quantity exceeds wallet limit"
);
require(_quantity * PRICE <= msg.value, "Not enough minerals");
mint(_quantity);
}
function mint(uint256 _quantity) internal {
require(
_quantity + totalSupply() <= PUBLIC_SUPPLY,
"Purchase exceeds available supply"
);
_safeMint(msg.sender, _quantity);
mintBalances[msg.sender] += _quantity;
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
require(_exists(tokenId), '"ERC721Metadata: tokenId does not exist"');
return string(abi.encodePacked(baseTokenURI, tokenId.toString()));
}
function senderMessageHash(uint256 tier) internal view returns (bytes32) {
bytes32 message = keccak256(
abi.encodePacked(
"\x19Ethereum Signed Message:\n32",
keccak256(abi.encodePacked(address(this), msg.sender, tier))
)
);
return message;
}
/**
* Override isApprovedForAll to whitelist user's OpenSea proxy accounts
* to enable gas-less listings.
*/
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
// whitelist OpenSea proxy contract for easy trading.
ProxyRegistry proxyRegistry = ProxyRegistry(_proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
function checkHash(
uint256 _tier,
bytes32 _hash,
bytes memory signature,
address _account
) internal view returns (bool) {
bytes32 senderHash = senderMessageHash(_tier);
if (senderHash != _hash) {
return false;
}
return _hash.recover(signature) == _account;
}
//----------------------------------------------------------------------------
// Only Owner
//----------------------------------------------------------------------------
function setSigner(address _address) external onlyOwner {
_SIGNER = _address;
}
// @dev gift a single token to each address passed in through calldata
// @param _recipients Array of addresses to send a single token to
function gift(address[] calldata _recipients) external onlyOwner {
uint256 recipients = _recipients.length;
require(
recipients + totalSupply() <= MAX_SUPPLY,
"_quantity exceeds supply"
);
for (uint256 i = 0; i < recipients; i++) {
_safeMint(_recipients[i], 1);
}
}
function setPaused(bool _state) external onlyOwner {
_state ? _pause() : _unpause();
}
function setPresale(bool _state) external onlyOwner {
isPresale = _state;
}
function setWalletLimit(bool _state) external onlyOwner {
publicWalletLimit = _state;
}
function setTokenOffset() public onlyOwner {
require(tokenOffset == 0, "Offset is already set");
requestRandomness(LINK_KEY_HASH, LINK_FEE);
}
// @dev chainlink callback function for requestRandomness
function fulfillRandomness(bytes32 requestId, uint256 randomness)
internal
override
{
tokenOffset = randomness % MAX_SUPPLY;
}
function setProvenance(string memory _provenance) external onlyOwner {
PROVENANCE_HASH = _provenance;
}
function setBaseURI(string memory _URI) external onlyOwner {
baseTokenURI = _URI;
}
// blockchain is forever, you never know, you might need these...
function setPrice(uint128 _price) external onlyOwner {
PRICE = _price;
}
function releaseReserve() external onlyOwner {
PUBLIC_SUPPLY = MAX_SUPPLY;
}
function setPublicLimit(uint128 _limit) external onlyOwner {
PUBLIC_MINT_LIMIT = _limit;
}
function withdrawAll() external onlyOwner {
for (uint256 i = 0; i < payees.length; i++) {
release(payable(payees[i]));
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {EIP712Base} from "./EIP712Base.sol";
contract NativeMetaTransaction is EIP712Base {
using SafeMath for uint256;
bytes32 private constant META_TRANSACTION_TYPEHASH =
keccak256(
bytes(
"MetaTransaction(uint256 nonce,address from,bytes functionSignature)"
)
);
event MetaTransactionExecuted(
address userAddress,
address payable relayerAddress,
bytes functionSignature
);
mapping(address => uint256) nonces;
/*
* Meta transaction structure.
* No point of including value field here as if user is doing value transfer then he has the funds to pay for gas
* He should call the desired function directly in that case.
*/
struct MetaTransaction {
uint256 nonce;
address from;
bytes functionSignature;
}
function executeMetaTransaction(
address userAddress,
bytes memory functionSignature,
bytes32 sigR,
bytes32 sigS,
uint8 sigV
) public payable returns (bytes memory) {
MetaTransaction memory metaTx = MetaTransaction({
nonce: nonces[userAddress],
from: userAddress,
functionSignature: functionSignature
});
require(
verify(userAddress, metaTx, sigR, sigS, sigV),
"Signer and signature do not match"
);
// increase nonce for user (to avoid re-use)
nonces[userAddress] = nonces[userAddress].add(1);
emit MetaTransactionExecuted(
userAddress,
payable(msg.sender),
functionSignature
);
// Append userAddress and relayer address at the end to extract it from calling context
(bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
return returnData;
}
function hashMetaTransaction(MetaTransaction memory metaTx)
internal
pure
returns (bytes32)
{
return
keccak256(
abi.encode(
META_TRANSACTION_TYPEHASH,
metaTx.nonce,
metaTx.from,
keccak256(metaTx.functionSignature)
)
);
}
function getNonce(address user) public view returns (uint256 nonce) {
nonce = nonces[user];
}
function verify(
address signer,
MetaTransaction memory metaTx,
bytes32 sigR,
bytes32 sigS,
uint8 sigV
) internal view returns (bool) {
require(signer != address(0), "NativeMetaTransaction: INVALID_SIGNER");
return
signer ==
ecrecover(
toTypedMessageHash(hashMetaTransaction(metaTx)),
sigV,
sigR,
sigS
);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Initializable {
bool inited = false;
modifier initializer() {
require(!inited, "already inited");
_;
inited = true;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Initializable} from "./Initializable.sol";
contract EIP712Base is Initializable {
struct EIP712Domain {
string name;
string version;
address verifyingContract;
bytes32 salt;
}
string public constant ERC712_VERSION = "1";
bytes32 internal constant EIP712_DOMAIN_TYPEHASH =
keccak256(
bytes(
"EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)"
)
);
bytes32 internal domainSeperator;
// supposed to be called once while initializing.
// one of the contracts that inherits this contract follows proxy pattern
// so it is not possible to do this in a constructor
function _initializeEIP712(string memory name) internal initializer {
_setDomainSeperator(name);
}
function _setDomainSeperator(string memory name) internal {
domainSeperator = keccak256(
abi.encode(
EIP712_DOMAIN_TYPEHASH,
keccak256(bytes(name)),
keccak256(bytes(ERC712_VERSION)),
address(this),
bytes32(getChainId())
)
);
}
function getDomainSeperator() public view returns (bytes32) {
return domainSeperator;
}
function getChainId() public view returns (uint256) {
uint256 id;
assembly {
id := chainid()
}
return id;
}
/**
* Accept message hash and returns hash message in EIP712 compatible form
* So that it can be used to recover signer from signature signed using EIP712 formatted data
* https://eips.ethereum.org/EIPS/eip-712
* "\\x19" makes the encoding deterministic
* "\\x01" is the version byte to make it compatible to EIP-191
*/
function toTypedMessageHash(bytes32 messageHash)
internal
view
returns (bytes32)
{
return
keccak256(
abi.encodePacked("\x19\x01", getDomainSeperator(), messageHash)
);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract ContextMixin {
function msgSender() internal view returns (address payable sender) {
if (msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
// Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those.
sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
}
} else {
sender = payable(msg.sender);
}
return sender;
}
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// Creator: Chiru Labs
pragma solidity ^0.8.4;
/**
* @dev Interface of ERC721A.
*/
interface IERC721A {
/**
* The caller must own the token or be an approved operator.
*/
error ApprovalCallerNotOwnerNorApproved();
/**
* The token does not exist.
*/
error ApprovalQueryForNonexistentToken();
/**
* 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();
// =============================================================
// STRUCTS
// =============================================================
struct TokenOwnership {
// The address of the owner.
address addr;
// Stores the start time of ownership with minimal overhead for tokenomics.
uint64 startTimestamp;
// Whether the token has been burned.
bool burned;
// Arbitrary data similar to `startTimestamp` that can be set via {_extraData}.
uint24 extraData;
}
// =============================================================
// TOKEN COUNTERS
// =============================================================
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() external view returns (uint256);
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
// =============================================================
// IERC721
// =============================================================
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables
* (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`,
* checking first that contract recipients are aware of the ERC721 protocol
* to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move
* this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom}
* whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @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](https://eips.ethereum.org/EIPS/eip-2309) standard.
*
* See {_mintERC2309} for more details.
*/
event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// Creator: Chiru Labs
pragma solidity ^0.8.4;
import './IERC721A.sol';
/**
* @dev Interface of ERC721 token receiver.
*/
interface ERC721A__IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @title ERC721A
*
* @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721)
* Non-Fungible Token Standard, including the Metadata extension.
* Optimized for lower gas during batch mints.
*
* Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...)
* starting from `_startTokenId()`.
*
* Assumptions:
*
* - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
* - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256).
*/
contract ERC721A is IERC721A {
// Reference type for token approval.
struct TokenApprovalRef {
address value;
}
// =============================================================
// CONSTANTS
// =============================================================
// Mask of an entry in packed address data.
uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1;
// The bit position of `numberMinted` in packed address data.
uint256 private constant _BITPOS_NUMBER_MINTED = 64;
// The bit position of `numberBurned` in packed address data.
uint256 private constant _BITPOS_NUMBER_BURNED = 128;
// The bit position of `aux` in packed address data.
uint256 private constant _BITPOS_AUX = 192;
// Mask of all 256 bits in packed address data except the 64 bits for `aux`.
uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1;
// The bit position of `startTimestamp` in packed ownership.
uint256 private constant _BITPOS_START_TIMESTAMP = 160;
// The bit mask of the `burned` bit in packed ownership.
uint256 private constant _BITMASK_BURNED = 1 << 224;
// The bit position of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITPOS_NEXT_INITIALIZED = 225;
// The bit mask of the `nextInitialized` bit in packed ownership.
uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225;
// The bit position of `extraData` in packed ownership.
uint256 private constant _BITPOS_EXTRA_DATA = 232;
// Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`.
uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1;
// The mask of the lower 160 bits for addresses.
uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1;
// The maximum `quantity` that can be minted with {_mintERC2309}.
// This limit is to prevent overflows on the address data entries.
// For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309}
// is required to cause an overflow, which is unrealistic.
uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000;
// The `Transfer` event signature is given by:
// `keccak256(bytes("Transfer(address,address,uint256)"))`.
bytes32 private constant _TRANSFER_EVENT_SIGNATURE =
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef;
// =============================================================
// STORAGE
// =============================================================
// The next token ID to be minted.
uint256 private _currentIndex;
// The number of tokens burned.
uint256 private _burnCounter;
// Token name
string private _name;
// Token symbol
string private _symbol;
// Mapping from token ID to ownership details
// An empty struct value does not necessarily mean the token is unowned.
// See {_packedOwnershipOf} implementation for details.
//
// Bits Layout:
// - [0..159] `addr`
// - [160..223] `startTimestamp`
// - [224] `burned`
// - [225] `nextInitialized`
// - [232..255] `extraData`
mapping(uint256 => uint256) private _packedOwnerships;
// Mapping owner address to address data.
//
// Bits Layout:
// - [0..63] `balance`
// - [64..127] `numberMinted`
// - [128..191] `numberBurned`
// - [192..255] `aux`
mapping(address => uint256) private _packedAddressData;
// Mapping from token ID to approved address.
mapping(uint256 => TokenApprovalRef) private _tokenApprovals;
// Mapping from owner to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// =============================================================
// CONSTRUCTOR
// =============================================================
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
// =============================================================
// TOKEN COUNTING OPERATIONS
// =============================================================
/**
* @dev Returns the starting token ID.
* To change the starting token ID, please override this function.
*/
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev Returns the next token ID to be minted.
*/
function _nextTokenId() internal view virtual returns (uint256) {
return _currentIndex;
}
/**
* @dev Returns the total number of tokens in existence.
* Burned tokens will reduce the count.
* To get the total number of tokens minted, please see {_totalMinted}.
*/
function totalSupply() public view virtual override returns (uint256) {
// Counter underflow is impossible as _burnCounter cannot be incremented
// more than `_currentIndex - _startTokenId()` times.
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
/**
* @dev Returns the total amount of tokens minted in the contract.
*/
function _totalMinted() internal view virtual returns (uint256) {
// Counter underflow is impossible as `_currentIndex` does not decrement,
// and it is initialized to `_startTokenId()`.
unchecked {
return _currentIndex - _startTokenId();
}
}
/**
* @dev Returns the total number of tokens burned.
*/
function _totalBurned() internal view virtual returns (uint256) {
return _burnCounter;
}
// =============================================================
// ADDRESS DATA OPERATIONS
// =============================================================
/**
* @dev Returns the number of tokens in `owner`'s account.
*/
function balanceOf(address owner) public view virtual override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens minted by `owner`.
*/
function _numberMinted(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the number of tokens burned by or on behalf of `owner`.
*/
function _numberBurned(address owner) internal view returns (uint256) {
return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY;
}
/**
* Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
*/
function _getAux(address owner) internal view returns (uint64) {
return uint64(_packedAddressData[owner] >> _BITPOS_AUX);
}
/**
* Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used).
* If there are multiple variables, please pack them into a uint64.
*/
function _setAux(address owner, uint64 aux) internal virtual {
uint256 packed = _packedAddressData[owner];
uint256 auxCasted;
// Cast `aux` with assembly to avoid redundant masking.
assembly {
auxCasted := aux
}
packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX);
_packedAddressData[owner] = packed;
}
// =============================================================
// IERC165
// =============================================================
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified)
* to learn more about how these ids are created.
*
* This function call must use less than 30000 gas.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
// The interface IDs are constants representing the first 4 bytes
// of the XOR of all function selectors in the interface.
// See: [ERC165](https://eips.ethereum.org/EIPS/eip-165)
// (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`)
return
interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165.
interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721.
interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata.
}
// =============================================================
// IERC721Metadata
// =============================================================
/**
* @dev Returns the token collection name.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the token collection symbol.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
string memory baseURI = _baseURI();
return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : '';
}
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, it can be overridden in child contracts.
*/
function _baseURI() internal view virtual returns (string memory) {
return '';
}
// =============================================================
// OWNERSHIPS OPERATIONS
// =============================================================
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
return address(uint160(_packedOwnershipOf(tokenId)));
}
/**
* @dev Gas spent here starts off proportional to the maximum mint batch size.
* It gradually moves to O(1) as tokens get transferred around over time.
*/
function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnershipOf(tokenId));
}
/**
* @dev Returns the unpacked `TokenOwnership` struct at `index`.
*/
function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) {
return _unpackedOwnership(_packedOwnerships[index]);
}
/**
* @dev Initializes the ownership slot minted at `index` for efficiency purposes.
*/
function _initializeOwnershipAt(uint256 index) internal virtual {
if (_packedOwnerships[index] == 0) {
_packedOwnerships[index] = _packedOwnershipOf(index);
}
}
/**
* Returns the packed ownership data of `tokenId`.
*/
function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr)
if (curr < _currentIndex) {
uint256 packed = _packedOwnerships[curr];
// If not burned.
if (packed & _BITMASK_BURNED == 0) {
// Invariant:
// There will always be an initialized ownership slot
// (i.e. `ownership.addr != address(0) && ownership.burned == false`)
// before an unintialized ownership slot
// (i.e. `ownership.addr == address(0) && ownership.burned == false`)
// Hence, `curr` will not underflow.
//
// We can directly compare the packed value.
// If the address is zero, packed will be zero.
while (packed == 0) {
packed = _packedOwnerships[--curr];
}
return packed;
}
}
}
revert OwnerQueryForNonexistentToken();
}
/**
* @dev Returns the unpacked `TokenOwnership` struct from `packed`.
*/
function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) {
ownership.addr = address(uint160(packed));
ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP);
ownership.burned = packed & _BITMASK_BURNED != 0;
ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA);
}
/**
* @dev Packs ownership data into a single uint256.
*/
function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`.
result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags))
}
}
/**
* @dev Returns the `nextInitialized` flag set if `quantity` equals 1.
*/
function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) {
// For branchless setting of the `nextInitialized` flag.
assembly {
// `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`.
result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1))
}
}
// =============================================================
// APPROVAL OPERATIONS
// =============================================================
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the
* zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) public virtual override {
address owner = ownerOf(tokenId);
if (_msgSenderERC721A() != owner)
if (!isApprovedForAll(owner, _msgSenderERC721A())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_tokenApprovals[tokenId].value = to;
emit Approval(owner, to, tokenId);
}
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) public view virtual override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId].value;
}
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom}
* for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
if (operator == _msgSenderERC721A()) revert ApproveToCaller();
_operatorApprovals[_msgSenderERC721A()][operator] = approved;
emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
}
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
return _operatorApprovals[owner][operator];
}
/**
* @dev Returns whether `tokenId` exists.
*
* Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
*
* Tokens start existing when they are minted. See {_mint}.
*/
function _exists(uint256 tokenId) internal view virtual returns (bool) {
return
_startTokenId() <= tokenId &&
tokenId < _currentIndex && // If within bounds,
_packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned.
}
/**
* @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`.
*/
function _isSenderApprovedOrOwner(
address approvedAddress,
address owner,
address msgSender
) private pure returns (bool result) {
assembly {
// Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean.
owner := and(owner, _BITMASK_ADDRESS)
// Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
msgSender := and(msgSender, _BITMASK_ADDRESS)
// `msgSender == owner || msgSender == approvedAddress`.
result := or(eq(msgSender, owner), eq(msgSender, approvedAddress))
}
}
/**
* @dev Returns the storage slot and value for the approved address of `tokenId`.
*/
function _getApprovedSlotAndAddress(uint256 tokenId)
private
view
returns (uint256 approvedAddressSlot, address approvedAddress)
{
TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId];
// The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`.
assembly {
approvedAddressSlot := tokenApproval.slot
approvedAddress := sload(approvedAddressSlot)
}
}
// =============================================================
// TRANSFER OPERATIONS
// =============================================================
/**
* @dev Transfers `tokenId` from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner();
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// We can directly increment and decrement the balances.
--_packedAddressData[from]; // Updates: `balance -= 1`.
++_packedAddressData[to]; // Updates: `balance += 1`.
// Updates:
// - `address` to the next owner.
// - `startTimestamp` to the timestamp of transfering.
// - `burned` to `false`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
to,
_BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
/**
* @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual override {
safeTransferFrom(from, to, tokenId, '');
}
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) public virtual override {
transferFrom(from, to, tokenId);
if (to.code.length != 0)
if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
/**
* @dev Hook that is called before a set of serially-ordered token IDs
* are about to be transferred. This includes minting.
* And also called before burning one token.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Hook that is called after a set of serially-ordered token IDs
* have been transferred. This includes minting.
* And also called after one token has been burned.
*
* `startTokenId` - the first token ID to be transferred.
* `quantity` - the amount to be transferred.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` has been
* transferred to `to`.
* - When `from` is zero, `tokenId` has been minted for `to`.
* - When `to` is zero, `tokenId` has been burned by `from`.
* - `from` and `to` are never both zero.
*/
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
/**
* @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract.
*
* `from` - Previous owner of the given token ID.
* `to` - Target address that will receive the token.
* `tokenId` - Token ID to be transferred.
* `_data` - Optional data to send along with the call.
*
* Returns whether the call correctly returned the expected magic value.
*/
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns (
bytes4 retval
) {
return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
// =============================================================
// MINT OPERATIONS
// =============================================================
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {Transfer} event for each mint.
*/
function _mint(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are incredibly unrealistic.
// `balance` and `numberMinted` have a maximum limit of 2**64.
// `tokenId` has a maximum limit of 2**256.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
uint256 toMasked;
uint256 end = startTokenId + quantity;
// Use assembly to loop and emit the `Transfer` event for gas savings.
assembly {
// Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean.
toMasked := and(to, _BITMASK_ADDRESS)
// Emit the `Transfer` event.
log4(
0, // Start of data (0, since no data).
0, // End of data (0, since no data).
_TRANSFER_EVENT_SIGNATURE, // Signature.
0, // `address(0)`.
toMasked, // `to`.
startTokenId // `tokenId`.
)
for {
let tokenId := add(startTokenId, 1)
} iszero(eq(tokenId, end)) {
tokenId := add(tokenId, 1)
} {
// Emit the `Transfer` event. Similar to above.
log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId)
}
}
if (toMasked == 0) revert MintToZeroAddress();
_currentIndex = end;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Mints `quantity` tokens and transfers them to `to`.
*
* This function is intended for efficient minting only during contract creation.
*
* It emits only one {ConsecutiveTransfer} as defined in
* [ERC2309](https://eips.ethereum.org/EIPS/eip-2309),
* instead of a sequence of {Transfer} event(s).
*
* Calling this function outside of contract creation WILL make your contract
* non-compliant with the ERC721 standard.
* For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309
* {ConsecutiveTransfer} event is only permissible during contract creation.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `quantity` must be greater than 0.
*
* Emits a {ConsecutiveTransfer} event.
*/
function _mintERC2309(address to, uint256 quantity) internal virtual {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
// Overflows are unrealistic due to the above check for `quantity` to be below the limit.
unchecked {
// Updates:
// - `balance += quantity`.
// - `numberMinted += quantity`.
//
// We can directly add to the `balance` and `numberMinted`.
_packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1);
// Updates:
// - `address` to the owner.
// - `startTimestamp` to the timestamp of minting.
// - `burned` to `false`.
// - `nextInitialized` to `quantity == 1`.
_packedOwnerships[startTokenId] = _packOwnershipData(
to,
_nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0)
);
emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to);
_currentIndex = startTokenId + quantity;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
/**
* @dev Safely mints `quantity` tokens and transfers them to `to`.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement
* {IERC721Receiver-onERC721Received}, which is called for each safe transfer.
* - `quantity` must be greater than 0.
*
* See {_mint}.
*
* Emits a {Transfer} event for each mint.
*/
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal virtual {
_mint(to, quantity);
unchecked {
if (to.code.length != 0) {
uint256 end = _currentIndex;
uint256 index = end - quantity;
do {
if (!_checkContractOnERC721Received(address(0), to, index++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (index < end);
// Reentrancy protection.
if (_currentIndex != end) revert();
}
}
}
/**
* @dev Equivalent to `_safeMint(to, quantity, '')`.
*/
function _safeMint(address to, uint256 quantity) internal virtual {
_safeMint(to, quantity, '');
}
// =============================================================
// BURN OPERATIONS
// =============================================================
/**
* @dev Equivalent to `_burn(tokenId, false)`.
*/
function _burn(uint256 tokenId) internal virtual {
_burn(tokenId, false);
}
/**
* @dev Destroys `tokenId`.
* The approval is cleared when the token is burned.
*
* Requirements:
*
* - `tokenId` must exist.
*
* Emits a {Transfer} event.
*/
function _burn(uint256 tokenId, bool approvalCheck) internal virtual {
uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId);
address from = address(uint160(prevOwnershipPacked));
(uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId);
if (approvalCheck) {
// The nested ifs save around 20+ gas over a compound boolean condition.
if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A()))
if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved();
}
_beforeTokenTransfers(from, address(0), tokenId, 1);
// Clear approvals from the previous owner.
assembly {
if approvedAddress {
// This is equivalent to `delete _tokenApprovals[tokenId]`.
sstore(approvedAddressSlot, 0)
}
}
// Underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow.
// Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256.
unchecked {
// Updates:
// - `balance -= 1`.
// - `numberBurned += 1`.
//
// We can directly decrement the balance, and increment the number burned.
// This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`.
_packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1;
// Updates:
// - `address` to the last owner.
// - `startTimestamp` to the timestamp of burning.
// - `burned` to `true`.
// - `nextInitialized` to `true`.
_packedOwnerships[tokenId] = _packOwnershipData(
from,
(_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked)
);
// If the next slot may not have been initialized (i.e. `nextInitialized == false`) .
if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) {
uint256 nextTokenId = tokenId + 1;
// If the next slot's address is zero and not burned (i.e. packed value is zero).
if (_packedOwnerships[nextTokenId] == 0) {
// If the next slot is within bounds.
if (nextTokenId != _currentIndex) {
// Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`.
_packedOwnerships[nextTokenId] = prevOwnershipPacked;
}
}
}
}
emit Transfer(from, address(0), tokenId);
_afterTokenTransfers(from, address(0), tokenId, 1);
// Overflow not possible, as _burnCounter cannot be exceed _currentIndex times.
unchecked {
_burnCounter++;
}
}
// =============================================================
// EXTRA DATA OPERATIONS
// =============================================================
/**
* @dev Directly sets the extra data for the ownership data `index`.
*/
function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual {
uint256 packed = _packedOwnerships[index];
if (packed == 0) revert OwnershipNotInitializedForExtraData();
uint256 extraDataCasted;
// Cast `extraData` with assembly to avoid redundant masking.
assembly {
extraDataCasted := extraData
}
packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA);
_packedOwnerships[index] = packed;
}
/**
* @dev Called during each token transfer to set the 24bit `extraData` field.
* Intended to be overridden by the cosumer contract.
*
* `previousExtraData` - the value of `extraData` before transfer.
*
* Calling conditions:
*
* - When `from` and `to` are both non-zero, `from`'s `tokenId` will be
* transferred to `to`.
* - When `from` is zero, `tokenId` will be minted for `to`.
* - When `to` is zero, `tokenId` will be burned by `from`.
* - `from` and `to` are never both zero.
*/
function _extraData(
address from,
address to,
uint24 previousExtraData
) internal view virtual returns (uint24) {}
/**
* @dev Returns the next extra data for the packed ownership data.
* The returned result is shifted into position.
*/
function _nextExtraData(
address from,
address to,
uint256 prevOwnershipPacked
) private view returns (uint256) {
uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA);
return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA;
}
// =============================================================
// OTHER OPERATIONS
// =============================================================
/**
* @dev Returns the message sender (defaults to `msg.sender`).
*
* If you are writing GSN compatible contracts, you need to override this function.
*/
function _msgSenderERC721A() internal view virtual returns (address) {
return msg.sender;
}
/**
* @dev Converts a uint256 to its ASCII string decimal representation.
*/
function _toString(uint256 value) internal pure virtual returns (string memory str) {
assembly {
// The maximum value of a uint256 contains 78 digits (1 byte per digit),
// but we allocate 0x80 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: 0x20 + 3 * 0x20 = 0x80.
str := add(mload(0x40), 0x80)
// Update the free memory pointer to allocate.
mstore(0x40, str)
// Cache the end of the memory to calculate the length later.
let end := str
// We write the string from rightmost digit to leftmost digit.
// The following is essentially a do-while loop that also handles the zero case.
// prettier-ignore
for { let temp := value } 1 {} {
str := sub(str, 1)
// Write the character to the pointer.
// The ASCII index of the '0' character is 48.
mstore8(str, add(48, mod(temp, 10)))
// Keep dividing `temp` until zero.
temp := div(temp, 10)
// prettier-ignore
if iszero(temp) { break }
}
let length := sub(end, str)
// Move the pointer 32 bytes leftwards to make room for the length.
str := sub(str, 0x20)
// Store the length.
mstore(str, length)
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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.1 (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.1 (finance/PaymentSplitter.sol)
pragma solidity ^0.8.0;
import "../token/ERC20/utils/SafeERC20.sol";
import "../utils/Address.sol";
import "../utils/Context.sol";
/**
* @title PaymentSplitter
* @dev This contract allows to split Ether payments among a group of accounts. The sender does not need to be aware
* that the Ether will be split in this way, since it is handled transparently by the contract.
*
* The split can be in equal parts or in any other arbitrary proportion. The way this is specified is by assigning each
* account to a number of shares. Of all the Ether that this contract receives, each account will then be able to claim
* an amount proportional to the percentage of total shares they were assigned.
*
* `PaymentSplitter` follows a _pull payment_ model. This means that payments are not automatically forwarded to the
* accounts but kept in this contract, and the actual transfer is triggered as a separate step by calling the {release}
* function.
*
* NOTE: This contract assumes that ERC20 tokens will behave similarly to native tokens (Ether). Rebasing tokens, and
* tokens that apply fees during transfers, are likely to not be supported as expected. If in doubt, we encourage you
* to run tests before sending real value to this contract.
*/
contract PaymentSplitter is Context {
event PayeeAdded(address account, uint256 shares);
event PaymentReleased(address to, uint256 amount);
event ERC20PaymentReleased(IERC20 indexed token, address to, uint256 amount);
event PaymentReceived(address from, uint256 amount);
uint256 private _totalShares;
uint256 private _totalReleased;
mapping(address => uint256) private _shares;
mapping(address => uint256) private _released;
address[] private _payees;
mapping(IERC20 => uint256) private _erc20TotalReleased;
mapping(IERC20 => mapping(address => uint256)) private _erc20Released;
/**
* @dev Creates an instance of `PaymentSplitter` where each account in `payees` is assigned the number of shares at
* the matching position in the `shares` array.
*
* All addresses in `payees` must be non-zero. Both arrays must have the same non-zero length, and there must be no
* duplicates in `payees`.
*/
constructor(address[] memory payees, uint256[] memory shares_) payable {
require(payees.length == shares_.length, "PaymentSplitter: payees and shares length mismatch");
require(payees.length > 0, "PaymentSplitter: no payees");
for (uint256 i = 0; i < payees.length; i++) {
_addPayee(payees[i], shares_[i]);
}
}
/**
* @dev The Ether received will be logged with {PaymentReceived} events. Note that these events are not fully
* reliable: it's possible for a contract to receive Ether without triggering this function. This only affects the
* reliability of the events, and not the actual splitting of Ether.
*
* To learn more about this see the Solidity documentation for
* https://solidity.readthedocs.io/en/latest/contracts.html#fallback-function[fallback
* functions].
*/
receive() external payable virtual {
emit PaymentReceived(_msgSender(), msg.value);
}
/**
* @dev Getter for the total shares held by payees.
*/
function totalShares() public view returns (uint256) {
return _totalShares;
}
/**
* @dev Getter for the total amount of Ether already released.
*/
function totalReleased() public view returns (uint256) {
return _totalReleased;
}
/**
* @dev Getter for the total amount of `token` already released. `token` should be the address of an IERC20
* contract.
*/
function totalReleased(IERC20 token) public view returns (uint256) {
return _erc20TotalReleased[token];
}
/**
* @dev Getter for the amount of shares held by an account.
*/
function shares(address account) public view returns (uint256) {
return _shares[account];
}
/**
* @dev Getter for the amount of Ether already released to a payee.
*/
function released(address account) public view returns (uint256) {
return _released[account];
}
/**
* @dev Getter for the amount of `token` tokens already released to a payee. `token` should be the address of an
* IERC20 contract.
*/
function released(IERC20 token, address account) public view returns (uint256) {
return _erc20Released[token][account];
}
/**
* @dev Getter for the address of the payee number `index`.
*/
function payee(uint256 index) public view returns (address) {
return _payees[index];
}
/**
* @dev Triggers a transfer to `account` of the amount of Ether they are owed, according to their percentage of the
* total shares and their previous withdrawals.
*/
function release(address payable account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = address(this).balance + totalReleased();
uint256 payment = _pendingPayment(account, totalReceived, released(account));
require(payment != 0, "PaymentSplitter: account is not due payment");
_released[account] += payment;
_totalReleased += payment;
Address.sendValue(account, payment);
emit PaymentReleased(account, payment);
}
/**
* @dev Triggers a transfer to `account` of the amount of `token` tokens they are owed, according to their
* percentage of the total shares and their previous withdrawals. `token` must be the address of an IERC20
* contract.
*/
function release(IERC20 token, address account) public virtual {
require(_shares[account] > 0, "PaymentSplitter: account has no shares");
uint256 totalReceived = token.balanceOf(address(this)) + totalReleased(token);
uint256 payment = _pendingPayment(account, totalReceived, released(token, account));
require(payment != 0, "PaymentSplitter: account is not due payment");
_erc20Released[token][account] += payment;
_erc20TotalReleased[token] += payment;
SafeERC20.safeTransfer(token, account, payment);
emit ERC20PaymentReleased(token, account, payment);
}
/**
* @dev internal logic for computing the pending payment of an `account` given the token historical balances and
* already released amounts.
*/
function _pendingPayment(
address account,
uint256 totalReceived,
uint256 alreadyReleased
) private view returns (uint256) {
return (totalReceived * _shares[account]) / _totalShares - alreadyReleased;
}
/**
* @dev Add a new payee to the contract.
* @param account The address of the payee to add.
* @param shares_ The number of shares owned by the payee.
*/
function _addPayee(address account, uint256 shares_) private {
require(account != address(0), "PaymentSplitter: account is the zero address");
require(shares_ > 0, "PaymentSplitter: shares are 0");
require(_shares[account] == 0, "PaymentSplitter: account already has shares");
_payees.push(account);
_shares[account] = shares_;
_totalShares = _totalShares + shares_;
emit PayeeAdded(account, shares_);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface LinkTokenInterface {
function allowance(address owner, address spender) external view returns (uint256 remaining);
function approve(address spender, uint256 value) external returns (bool success);
function balanceOf(address owner) external view returns (uint256 balance);
function decimals() external view returns (uint8 decimalPlaces);
function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);
function increaseApproval(address spender, uint256 subtractedValue) external;
function name() external view returns (string memory tokenName);
function symbol() external view returns (string memory tokenSymbol);
function totalSupply() external view returns (uint256 totalTokensIssued);
function transfer(address to, uint256 value) external returns (bool success);
function transferAndCall(
address to,
uint256 value,
bytes calldata data
) external returns (bool success);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool success);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract VRFRequestIDBase {
/**
* @notice returns the seed which is actually input to the VRF coordinator
*
* @dev To prevent repetition of VRF output due to repetition of the
* @dev user-supplied seed, that seed is combined in a hash with the
* @dev user-specific nonce, and the address of the consuming contract. The
* @dev risk of repetition is mostly mitigated by inclusion of a blockhash in
* @dev the final seed, but the nonce does protect against repetition in
* @dev requests which are included in a single block.
*
* @param _userSeed VRF seed input provided by user
* @param _requester Address of the requesting contract
* @param _nonce User-specific nonce at the time of the request
*/
function makeVRFInputSeed(
bytes32 _keyHash,
uint256 _userSeed,
address _requester,
uint256 _nonce
) internal pure returns (uint256) {
return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
}
/**
* @notice Returns the id for this request
* @param _keyHash The serviceAgreement ID to be used for this request
* @param _vRFInputSeed The seed to be passed directly to the VRF
* @return The id for this request
*
* @dev Note that _vRFInputSeed is not the seed passed by the consuming
* @dev contract, but the one generated by makeVRFInputSeed
*/
function makeRequestId(bytes32 _keyHash, uint256 _vRFInputSeed) internal pure returns (bytes32) {
return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./interfaces/LinkTokenInterface.sol";
import "./VRFRequestIDBase.sol";
/** ****************************************************************************
* @notice Interface for contracts using VRF randomness
* *****************************************************************************
* @dev PURPOSE
*
* @dev Reggie the Random Oracle (not his real job) wants to provide randomness
* @dev to Vera the verifier in such a way that Vera can be sure he's not
* @dev making his output up to suit himself. Reggie provides Vera a public key
* @dev to which he knows the secret key. Each time Vera provides a seed to
* @dev Reggie, he gives back a value which is computed completely
* @dev deterministically from the seed and the secret key.
*
* @dev Reggie provides a proof by which Vera can verify that the output was
* @dev correctly computed once Reggie tells it to her, but without that proof,
* @dev the output is indistinguishable to her from a uniform random sample
* @dev from the output space.
*
* @dev The purpose of this contract is to make it easy for unrelated contracts
* @dev to talk to Vera the verifier about the work Reggie is doing, to provide
* @dev simple access to a verifiable source of randomness.
* *****************************************************************************
* @dev USAGE
*
* @dev Calling contracts must inherit from VRFConsumerBase, and can
* @dev initialize VRFConsumerBase's attributes in their constructor as
* @dev shown:
*
* @dev contract VRFConsumer {
* @dev constuctor(<other arguments>, address _vrfCoordinator, address _link)
* @dev VRFConsumerBase(_vrfCoordinator, _link) public {
* @dev <initialization with other arguments goes here>
* @dev }
* @dev }
*
* @dev The oracle will have given you an ID for the VRF keypair they have
* @dev committed to (let's call it keyHash), and have told you the minimum LINK
* @dev price for VRF service. Make sure your contract has sufficient LINK, and
* @dev call requestRandomness(keyHash, fee, seed), where seed is the input you
* @dev want to generate randomness from.
*
* @dev Once the VRFCoordinator has received and validated the oracle's response
* @dev to your request, it will call your contract's fulfillRandomness method.
*
* @dev The randomness argument to fulfillRandomness is the actual random value
* @dev generated from your seed.
*
* @dev The requestId argument is generated from the keyHash and the seed by
* @dev makeRequestId(keyHash, seed). If your contract could have concurrent
* @dev requests open, you can use the requestId to track which seed is
* @dev associated with which randomness. See VRFRequestIDBase.sol for more
* @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind,
* @dev if your contract could have multiple requests in flight simultaneously.)
*
* @dev Colliding `requestId`s are cryptographically impossible as long as seeds
* @dev differ. (Which is critical to making unpredictable randomness! See the
* @dev next section.)
*
* *****************************************************************************
* @dev SECURITY CONSIDERATIONS
*
* @dev A method with the ability to call your fulfillRandomness method directly
* @dev could spoof a VRF response with any random value, so it's critical that
* @dev it cannot be directly called by anything other than this base contract
* @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
*
* @dev For your users to trust that your contract's random behavior is free
* @dev from malicious interference, it's best if you can write it so that all
* @dev behaviors implied by a VRF response are executed *during* your
* @dev fulfillRandomness method. If your contract must store the response (or
* @dev anything derived from it) and use it later, you must ensure that any
* @dev user-significant behavior which depends on that stored value cannot be
* @dev manipulated by a subsequent VRF request.
*
* @dev Similarly, both miners and the VRF oracle itself have some influence
* @dev over the order in which VRF responses appear on the blockchain, so if
* @dev your contract could have multiple VRF requests in flight simultaneously,
* @dev you must ensure that the order in which the VRF responses arrive cannot
* @dev be used to manipulate your contract's user-significant behavior.
*
* @dev Since the ultimate input to the VRF is mixed with the block hash of the
* @dev block in which the request is made, user-provided seeds have no impact
* @dev on its economic security properties. They are only included for API
* @dev compatability with previous versions of this contract.
*
* @dev Since the block hash of the block which contains the requestRandomness
* @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
* @dev miner could, in principle, fork the blockchain to evict the block
* @dev containing the request, forcing the request to be included in a
* @dev different block with a different hash, and therefore a different input
* @dev to the VRF. However, such an attack would incur a substantial economic
* @dev cost. This cost scales with the number of blocks the VRF oracle waits
* @dev until it calls responds to a request.
*/
abstract contract VRFConsumerBase is VRFRequestIDBase {
/**
* @notice fulfillRandomness handles the VRF response. Your contract must
* @notice implement it. See "SECURITY CONSIDERATIONS" above for important
* @notice principles to keep in mind when implementing your fulfillRandomness
* @notice method.
*
* @dev VRFConsumerBase expects its subcontracts to have a method with this
* @dev signature, and will call it once it has verified the proof
* @dev associated with the randomness. (It is triggered via a call to
* @dev rawFulfillRandomness, below.)
*
* @param requestId The Id initially returned by requestRandomness
* @param randomness the VRF output
*/
function fulfillRandomness(bytes32 requestId, uint256 randomness) internal virtual;
/**
* @dev In order to keep backwards compatibility we have kept the user
* seed field around. We remove the use of it because given that the blockhash
* enters later, it overrides whatever randomness the used seed provides.
* Given that it adds no security, and can easily lead to misunderstandings,
* we have removed it from usage and can now provide a simpler API.
*/
uint256 private constant USER_SEED_PLACEHOLDER = 0;
/**
* @notice requestRandomness initiates a request for VRF output given _seed
*
* @dev The fulfillRandomness method receives the output, once it's provided
* @dev by the Oracle, and verified by the vrfCoordinator.
*
* @dev The _keyHash must already be registered with the VRFCoordinator, and
* @dev the _fee must exceed the fee specified during registration of the
* @dev _keyHash.
*
* @dev The _seed parameter is vestigial, and is kept only for API
* @dev compatibility with older versions. It can't *hurt* to mix in some of
* @dev your own randomness, here, but it's not necessary because the VRF
* @dev oracle will mix the hash of the block containing your request into the
* @dev VRF seed it ultimately uses.
*
* @param _keyHash ID of public key against which randomness is generated
* @param _fee The amount of LINK to send with the request
*
* @return requestId unique ID for this request
*
* @dev The returned requestId can be used to distinguish responses to
* @dev concurrent requests. It is passed as the first argument to
* @dev fulfillRandomness.
*/
function requestRandomness(bytes32 _keyHash, uint256 _fee) internal returns (bytes32 requestId) {
LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER));
// This is the seed passed to VRFCoordinator. The oracle will mix this with
// the hash of the block containing this request to obtain the seed/input
// which is finally passed to the VRF cryptographic machinery.
uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
// nonces[_keyHash] must stay in sync with
// VRFCoordinator.nonces[_keyHash][this], which was incremented by the above
// successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest).
// This provides protection against the user repeating their input seed,
// which would result in a predictable/duplicate output, if multiple such
// requests appeared in the same block.
nonces[_keyHash] = nonces[_keyHash] + 1;
return makeRequestId(_keyHash, vRFSeed);
}
LinkTokenInterface internal immutable LINK;
address private immutable vrfCoordinator;
// Nonces for each VRF key from which randomness has been requested.
//
// Must stay in sync with VRFCoordinator[_keyHash][this]
mapping(bytes32 => uint256) /* keyHash */ /* nonce */
private nonces;
/**
* @param _vrfCoordinator address of VRFCoordinator contract
* @param _link address of LINK token contract
*
* @dev https://docs.chain.link/docs/link-token-contracts
*/
constructor(address _vrfCoordinator, address _link) {
vrfCoordinator = _vrfCoordinator;
LINK = LinkTokenInterface(_link);
}
// rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
// proof. rawFulfillRandomness then calls fulfillRandomness, after validating
// the origin of the call
function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
fulfillRandomness(requestId, randomness);
}
}{
"remappings": [],
"optimizer": {
"enabled": true,
"runs": 11200
},
"evmVersion": "london",
"libraries": {},
"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":"string","name":"_uri","type":"string"},{"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"internalType":"address","name":"_vrfCoordinator","type":"address"},{"internalType":"address","name":"_linkToken","type":"address"},{"internalType":"uint256","name":"_linkFee","type":"uint256"},{"internalType":"address[]","name":"_payees","type":"address[]"},{"internalType":"uint256[]","name":"_shares","type":"uint256[]"},{"internalType":"address","name":"proxyRegistryAddress","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","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"},{"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":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ERC20PaymentReleased","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"address payable","name":"relayerAddress","type":"address"},{"indexed":false,"internalType":"bytes","name":"functionSignature","type":"bytes"}],"name":"MetaTransactionExecuted","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":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"PayeeAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PaymentReleased","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":"ERC712_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PROVENANCE_HASH","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PUBLIC_MINT_LIMIT","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PUBLIC_SUPPLY","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"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":"address","name":"userAddress","type":"address"},{"internalType":"bytes","name":"functionSignature","type":"bytes"},{"internalType":"bytes32","name":"sigR","type":"bytes32"},{"internalType":"bytes32","name":"sigS","type":"bytes32"},{"internalType":"uint8","name":"sigV","type":"uint8"}],"name":"executeMetaTransaction","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDomainSeperator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNonce","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_recipients","type":"address[]"}],"name":"gift","outputs":[],"stateMutability":"nonpayable","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":"isPresale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"mintBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"payee","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"uint256","name":"_tier","type":"uint256"},{"internalType":"bytes32","name":"_hash","type":"bytes32"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"presalePurchase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicWalletLimit","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"purchase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"release","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"releaseReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"released","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_URI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_price","type":"uint128"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_provenance","type":"string"}],"name":"setProvenance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"_limit","type":"uint128"}],"name":"setPublicLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setTokenOffset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_state","type":"bool"}],"name":"setWalletLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"shares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenOffset","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReleased","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60e060408190526008805460ff191690557113880000000000000000000000000000132460155576b1a2bc2ec500000000000000000000000000000000000a6016556017805461ffff1916610101179055620052b4388190039081908339810160408190526200006f9162000835565b828287876040518060400160405280600b81526020016a13595b9a9a5cd5dbdc9b1960aa1b815250604051806040016040528060028152602001614d5760f01b8152508160029080519060200190620000ca9291906200059b565b508051620000e09060039060208401906200059b565b50506000805550620000f233620002ac565b600b805460ff60a01b191690556001600c556001600160601b0319606092831b811660a052911b1660805280518251146200018f5760405162461bcd60e51b815260206004820152603260248201527f5061796d656e7453706c69747465723a2070617965657320616e6420736861726044820152710cae640d8cadccee8d040dad2e6dac2e8c6d60731b60648201526084015b60405180910390fd5b6000825111620001e25760405162461bcd60e51b815260206004820152601a60248201527f5061796d656e7453706c69747465723a206e6f20706179656573000000000000604482015260640162000186565b60005b82518110156200024e5762000239838281518110620002085762000208620009f7565b6020026020010151838381518110620002255762000225620009f7565b6020026020010151620002fe60201b60201c565b806200024581620009c3565b915050620001e5565b506200025c915050620004ec565b87516200027190601b9060208b01906200059b565b5082516200028790601c9060208601906200062a565b50601f969096555050601e55505060601b6001600160601b03191660c0525062000a23565b600b80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b0382166200036b5760405162461bcd60e51b815260206004820152602c60248201527f5061796d656e7453706c69747465723a206163636f756e74206973207468652060448201526b7a65726f206164647265737360a01b606482015260840162000186565b60008111620003bd5760405162461bcd60e51b815260206004820152601d60248201527f5061796d656e7453706c69747465723a20736861726573206172652030000000604482015260640162000186565b6001600160a01b03821660009081526010602052604090205415620004395760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e7420616c726561647960448201526a206861732073686172657360a81b606482015260840162000186565b60128054600181019091557fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34440180546001600160a01b0319166001600160a01b0384169081179091556000908152601060205260409020819055600e54620004a39082906200096b565b600e55604080516001600160a01b0384168152602081018390527f40c340f65e17194d14ddddb073d3c9f888e3cb52b5aae0c6c7706b4fbc905fac910160405180910390a15050565b62000500600b54600160a01b900460ff1690565b15620005425760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640162000186565b600b805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586200057e3390565b6040516001600160a01b03909116815260200160405180910390a1565b828054620005a99062000986565b90600052602060002090601f016020900481019282620005cd576000855562000618565b82601f10620005e857805160ff191683800117855562000618565b8280016001018555821562000618579182015b8281111562000618578251825591602001919060010190620005fb565b506200062692915062000682565b5090565b82805482825590600052602060002090810192821562000618579160200282015b828111156200061857825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906200064b565b5b8082111562000626576000815560010162000683565b80516001600160a01b0381168114620006b157600080fd5b919050565b600082601f830112620006c857600080fd5b81516020620006e1620006db8362000945565b62000912565b80838252828201915082860187848660051b89010111156200070257600080fd5b60005b858110156200072c57620007198262000699565b8452928401929084019060010162000705565b5090979650505050505050565b600082601f8301126200074b57600080fd5b815160206200075e620006db8362000945565b80838252828201915082860187848660051b89010111156200077f57600080fd5b60005b858110156200072c5781518452928401929084019060010162000782565b600082601f830112620007b257600080fd5b81516001600160401b03811115620007ce57620007ce62000a0d565b6020620007e4601f8301601f1916820162000912565b8281528582848701011115620007f957600080fd5b60005b8381101562000819578581018301518282018401528201620007fc565b838111156200082b5760008385840101525b5095945050505050565b600080600080600080600080610100898b0312156200085357600080fd5b88516001600160401b03808211156200086b57600080fd5b620008798c838d01620007a0565b995060208b015198506200089060408c0162000699565b9750620008a060608c0162000699565b965060808b0151955060a08b0151915080821115620008be57600080fd5b620008cc8c838d01620006b6565b945060c08b0151915080821115620008e357600080fd5b50620008f28b828c0162000739565b9250506200090360e08a0162000699565b90509295985092959890939650565b604051601f8201601f191681016001600160401b03811182821017156200093d576200093d62000a0d565b604052919050565b60006001600160401b0382111562000961576200096162000a0d565b5060051b60200190565b60008219821115620009815762000981620009e1565b500190565b600181811c908216806200099b57607f821691505b60208210811415620009bd57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415620009da57620009da620009e1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60805160601c60a05160601c60c05160601c61485162000a63600039600061239b015260008181611f260152612a5901526000612a2a01526148516000f3fe60806040526004361061036f5760003560e01c8063762d3377116101c6578063bceae77b116100f7578063dc8c57b411610095578063efef39a11161006f578063efef39a114610b10578063f2fde38b14610b23578063ff1b655614610b43578063ffe630b514610b5857600080fd5b8063dc8c57b414610ac5578063e33b7de314610adb578063e985e9c514610af057600080fd5b8063c87b56dd116100d1578063c87b56dd14610a24578063ce7c2ac214610a44578063d3933ada14610a7a578063d79779b214610a8f57600080fd5b8063bceae77b146109bb578063bf34be44146109e4578063c54e73e314610a0457600080fd5b806395364a8411610164578063a22cb4651161013e578063a22cb46514610934578063abd0359614610954578063b88d4fde1461096e578063bc56602f1461098e57600080fd5b806395364a84146108ca57806395d89b41146108e95780639852595c146108fe57600080fd5b80638b83209b116101a05780638b83209b1461082f5780638d859f3e1461084f5780638da5cb5b1461088c57806394985ddd146108aa57600080fd5b8063762d3377146107de5780638342083a146107f1578063853828b61461081a57600080fd5b806332cb6b0c116102a057806355f804b31161023e5780636c19e783116102185780636c19e783146107695780636cf806901461078957806370a08231146107a9578063715018a6146107c957600080fd5b806355f804b3146106f95780635c975abb146107195780636352211e1461074957600080fd5b80633ae84a821161027a5780633ae84a8214610653578063406072a91461067357806342842e0e146106b957806348b75044146106d957600080fd5b806332cb6b0c146105cd5780633408e4701461062b5780633a98ef391461063e57600080fd5b8063163e1e611161030d57806319165587116102e7578063191655871461054257806320379ee51461056257806323b872dd146105775780632d0335ab1461059757600080fd5b8063163e1e61146104df57806316c38b3c146104ff57806318160ddd1461051f57600080fd5b8063095ea7b311610349578063095ea7b31461044c5780630c53c51c1461046e5780630f1876a2146104815780630f7e59701461049657600080fd5b806301ffc9a7146103bd57806306fdde03146103f2578063081812fc1461041457600080fd5b366103b8577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156103c957600080fd5b506103dd6103d83660046141bc565b610b78565b60405190151581526020015b60405180910390f35b3480156103fe57600080fd5b50610407610c5d565b6040516103e9919061453c565b34801561042057600080fd5b5061043461042f36600461428e565b610cef565b6040516001600160a01b0390911681526020016103e9565b34801561045857600080fd5b5061046c6104673660046140bf565b610d4c565b005b61040761047c366004614041565b610e1d565b34801561048d57600080fd5b5061046c611046565b3480156104a257600080fd5b506104076040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b3480156104eb57600080fd5b5061046c6104fa3660046140eb565b611101565b34801561050b57600080fd5b5061046c61051a366004614160565b61123f565b34801561052b57600080fd5b50600154600054035b6040519081526020016103e9565b34801561054e57600080fd5b5061046c61055d366004613f10565b6112ae565b34801561056e57600080fd5b50600954610534565b34801561058357600080fd5b5061046c610592366004613f66565b611488565b3480156105a357600080fd5b506105346105b2366004613f10565b6001600160a01b03166000908152600a602052604090205490565b3480156105d957600080fd5b5060155461060a9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b6040516fffffffffffffffffffffffffffffffff90911681526020016103e9565b34801561063757600080fd5b5046610534565b34801561064a57600080fd5b50600e54610534565b34801561065f57600080fd5b5061046c61066e36600461425c565b6116b5565b34801561067f57600080fd5b5061053461068e366004613f2d565b6001600160a01b03918216600090815260146020908152604080832093909416825291909152205490565b3480156106c557600080fd5b5061046c6106d4366004613f66565b611744565b3480156106e557600080fd5b5061046c6106f4366004613f2d565b611764565b34801561070557600080fd5b5061046c610714366004614213565b611a11565b34801561072557600080fd5b50600b5474010000000000000000000000000000000000000000900460ff166103dd565b34801561075557600080fd5b5061043461076436600461428e565b611a82565b34801561077557600080fd5b5061046c610784366004613f10565b611a8d565b34801561079557600080fd5b5061046c6107a4366004614160565b611b21565b3480156107b557600080fd5b506105346107c4366004613f10565b611bac565b3480156107d557600080fd5b5061046c611c14565b61046c6107ec3660046142c0565b611c7a565b3480156107fd57600080fd5b5060155461060a906fffffffffffffffffffffffffffffffff1681565b34801561082657600080fd5b5061046c611e42565b34801561083b57600080fd5b5061043461084a36600461428e565b611eeb565b34801561085b57600080fd5b5060165461060a9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b34801561089857600080fd5b50600b546001600160a01b0316610434565b3480156108b657600080fd5b5061046c6108c536600461419a565b611f1b565b3480156108d657600080fd5b506017546103dd90610100900460ff1681565b3480156108f557600080fd5b50610407611f9d565b34801561090a57600080fd5b50610534610919366004613f10565b6001600160a01b031660009081526011602052604090205490565b34801561094057600080fd5b5061046c61094f366004614013565b611fac565b34801561096057600080fd5b506017546103dd9060ff1681565b34801561097a57600080fd5b5061046c610989366004613fa7565b612079565b34801561099a57600080fd5b506105346109a9366004613f10565b60196020526000908152604090205481565b3480156109c757600080fd5b5060165461060a906fffffffffffffffffffffffffffffffff1681565b3480156109f057600080fd5b5061046c6109ff36600461425c565b6120d6565b348015610a1057600080fd5b5061046c610a1f366004614160565b612173565b348015610a3057600080fd5b50610407610a3f36600461428e565b612204565b348015610a5057600080fd5b50610534610a5f366004613f10565b6001600160a01b031660009081526010602052604090205490565b348015610a8657600080fd5b5061046c6122b3565b348015610a9b57600080fd5b50610534610aaa366004613f10565b6001600160a01b031660009081526013602052604090205490565b348015610ad157600080fd5b50610534601a5481565b348015610ae757600080fd5b50600f54610534565b348015610afc57600080fd5b506103dd610b0b366004613f2d565b612360565b61046c610b1e36600461428e565b612467565b348015610b2f57600080fd5b5061046c610b3e366004613f10565b6126f1565b348015610b4f57600080fd5b506104076127d0565b348015610b6457600080fd5b5061046c610b73366004614213565b61285e565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161480610c0b57507f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b80610c5757507f5b5e139f000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b606060028054610c6c906145fb565b80601f0160208091040260200160405190810160405280929190818152602001828054610c98906145fb565b8015610ce55780601f10610cba57610100808354040283529160200191610ce5565b820191906000526020600020905b815481529060010190602001808311610cc857829003601f168201915b5050505050905090565b6000610cfa826128cb565b610d30576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610d5782611a82565b9050336001600160a01b03821614610da957610d738133612360565b610da9576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60408051606081810183526001600160a01b0388166000818152600a602090815290859020548452830152918101869052610e5b878287878761290b565b610ed25760405162461bcd60e51b815260206004820152602160248201527f5369676e657220616e64207369676e617475726520646f206e6f74206d61746360448201527f680000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b0387166000908152600a6020526040902054610ef6906001612a13565b6001600160a01b0388166000908152600a60205260409081902091909155517f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b90610f4690899033908a906144ac565b60405180910390a1600080306001600160a01b0316888a604051602001610f6e929190614384565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610fa691614368565b6000604051808303816000865af19150503d8060008114610fe3576040519150601f19603f3d011682016040523d82523d6000602084013e610fe8565b606091505b50915091508161103a5760405162461bcd60e51b815260206004820152601c60248201527f46756e6374696f6e2063616c6c206e6f74207375636365737366756c000000006044820152606401610ec9565b98975050505050505050565b600b546001600160a01b031633146110a05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601a54156110f05760405162461bcd60e51b815260206004820152601560248201527f4f666673657420697320616c72656164792073657400000000000000000000006044820152606401610ec9565b6110fe601f54601e54612a26565b50565b600b546001600160a01b0316331461115b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601554819070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff166111936001546000540390565b61119d908361454f565b11156111eb5760405162461bcd60e51b815260206004820152601860248201527f5f7175616e74697479206578636565647320737570706c7900000000000000006044820152606401610ec9565b60005b818110156112395761122784848381811061120b5761120b614729565b90506020020160208101906112209190613f10565b6001612bb1565b806112318161464f565b9150506111ee565b50505050565b600b546001600160a01b031633146112995760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b806112a6576110fe612bcb565b6110fe612c9d565b6001600160a01b0381166000908152601060205260409020546113395760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201527f73686172657300000000000000000000000000000000000000000000000000006064820152608401610ec9565b6000611344600f5490565b61134e904761454f565b9050600061137b8383611376866001600160a01b031660009081526011602052604090205490565b612d6f565b9050806113f05760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201527f647565207061796d656e740000000000000000000000000000000000000000006064820152608401610ec9565b6001600160a01b0383166000908152601160205260408120805483929061141890849061454f565b9250508190555080600f6000828254611431919061454f565b9091555061144190508382612dad565b604080516001600160a01b0385168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a1505050565b600061149382612ec6565b9050836001600160a01b0316816001600160a01b0316146114e0576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417611546576115108633612360565b611546576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038516611586576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b801561159157600082555b6001600160a01b0386811660009081526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019055918716808252919020805460010190554260a01b177c0200000000000000000000000000000000000000000000000000000000176000858152600460205260409020557c0200000000000000000000000000000000000000000000000000000000831661166c576001840160008181526004602052604090205461166a57600054811461166a5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b600b546001600160a01b0316331461170f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601680546fffffffffffffffffffffffffffffffff928316700100000000000000000000000000000000029216919091179055565b61175f83838360405180602001604052806000815250612079565b505050565b6001600160a01b0381166000908152601060205260409020546117ef5760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201527f73686172657300000000000000000000000000000000000000000000000000006064820152608401610ec9565b6001600160a01b0382166000908152601360205260408120546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038516906370a082319060240160206040518083038186803b15801561186057600080fd5b505afa158015611874573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189891906142a7565b6118a2919061454f565b905060006118db838361137687876001600160a01b03918216600090815260146020908152604080832093909416825291909152205490565b9050806119505760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201527f647565207061796d656e740000000000000000000000000000000000000000006064820152608401610ec9565b6001600160a01b0380851660009081526014602090815260408083209387168352929052908120805483929061198790849061454f565b90915550506001600160a01b038416600090815260136020526040812080548392906119b490849061454f565b909155506119c59050848483612f77565b604080516001600160a01b038581168252602082018490528616917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a250505050565b600b546001600160a01b03163314611a6b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b8051611a7e90601b906020840190613dc3565b5050565b6000610c5782612ec6565b600b546001600160a01b03163314611ae75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601d80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600b546001600160a01b03163314611b7b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60006001600160a01b038216611bee576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b600b546001600160a01b03163314611c6e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b611c786000612ff7565b565b600b5474010000000000000000000000000000000000000000900460ff1615611ce55760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ec9565b601d54611d00908490849084906001600160a01b0316613061565b611d4c5760405162461bcd60e51b815260206004820152601560248201527f50726573616c654d696e744e6f74416c6c6f77656400000000000000000000006044820152606401610ec9565b336000908152601960205260409020548390611d68908661454f565b1115611db65760405162461bcd60e51b815260206004820152601d60248201527f5175616e7469747920657863656564732077616c6c6574206c696d69740000006044820152606401610ec9565b6016543490611deb9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff168661457b565b1115611e395760405162461bcd60e51b815260206004820152601360248201527f4e6f7420656e6f756768206d696e6572616c73000000000000000000000000006044820152606401610ec9565b61123984613142565b600b546001600160a01b03163314611e9c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b60005b601c548110156110fe57611ed9601c8281548110611ebf57611ebf614729565b6000918252602090912001546001600160a01b03166112ae565b80611ee38161464f565b915050611e9f565b600060128281548110611f0057611f00614729565b6000918252602090912001546001600160a01b031692915050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611f935760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610ec9565b611a7e8282613213565b606060038054610c6c906145fb565b6001600160a01b038216331415611fef576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b0387168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b612084848484611488565b6001600160a01b0383163b15611239576120a08484848461324d565b611239576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b546001600160a01b031633146121305760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601680547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b600b546001600160a01b031633146121cd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b60178054911515610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909216919091179055565b606061220f826128cb565b6122815760405162461bcd60e51b815260206004820152602860248201527f224552433732314d657461646174613a20746f6b656e496420646f6573206e6f60448201527f74206578697374220000000000000000000000000000000000000000000000006064820152608401610ec9565b601b61228c836133c2565b60405160200161229d9291906143ce565b6040516020818303038152906040529050919050565b600b546001600160a01b0316331461230d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b6015805470010000000000000000000000000000000081046fffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116179055565b6040517fc45527910000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526000917f000000000000000000000000000000000000000000000000000000000000000091848116919083169063c45527919060240160206040518083038186803b1580156123e457600080fd5b505afa1580156123f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061241c91906141f6565b6001600160a01b03161415612435576001915050610c57565b6001600160a01b0380851660009081526007602090815260408083209387168352929052205460ff165b949350505050565b600b5474010000000000000000000000000000000000000000900460ff16156124d25760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ec9565b601754610100900460ff161561252a5760405162461bcd60e51b815260206004820152600d60248201527f50726573616c65206f6e6c792e000000000000000000000000000000000000006044820152606401610ec9565b6016546fffffffffffffffffffffffffffffffff168111156125b45760405162461bcd60e51b815260206004820152602260248201527f5175616e746974792065786365656473205055424c49435f4d494e545f4c494d60448201527f49540000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b60175460ff161561266557601654336000908152601960205260409020546fffffffffffffffffffffffffffffffff909116906125f1908361454f565b11156126655760405162461bcd60e51b815260206004820152602160248201527f5175616e746974792065786365656473207065722d77616c6c6574206c696d6960448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b601654349061269a9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff168361457b565b11156126e85760405162461bcd60e51b815260206004820152601360248201527f4e6f7420656e6f756768206d696e6572616c73000000000000000000000000006044820152606401610ec9565b6110fe81613142565b600b546001600160a01b0316331461274b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b6001600160a01b0381166127c75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610ec9565b6110fe81612ff7565b601880546127dd906145fb565b80601f0160208091040260200160405190810160405280929190818152602001828054612809906145fb565b80156128565780601f1061282b57610100808354040283529160200191612856565b820191906000526020600020905b81548152906001019060200180831161283957829003601f168201915b505050505081565b600b546001600160a01b031633146128b85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b8051611a7e906018906020840190613dc3565b6000805482108015610c575750506000908152600460205260409020547c0100000000000000000000000000000000000000000000000000000000161590565b60006001600160a01b0386166129895760405162461bcd60e51b815260206004820152602560248201527f4e61746976654d6574615472616e73616374696f6e3a20494e56414c49445f5360448201527f49474e45520000000000000000000000000000000000000000000000000000006064820152608401610ec9565b600161299c612997876134f4565b613571565b6040805160008152602081018083529290925260ff851690820152606081018690526080810185905260a0016020604051602081039080840390855afa1580156129ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316866001600160a01b031614905095945050505050565b6000612a1f828461454f565b9392505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001612a96929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401612ac393929190614514565b602060405180830381600087803b158015612add57600080fd5b505af1158015612af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b15919061417d565b506000838152600d6020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052612b7190600161454f565b6000858152600d602052604090205561245f8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b611a7e8282604051806020016040528060008152506135bc565b600b5474010000000000000000000000000000000000000000900460ff16612c355760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610ec9565b600b80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600b5474010000000000000000000000000000000000000000900460ff1615612d085760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ec9565b600b80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612c803390565b600e546001600160a01b03841660009081526010602052604081205490918391612d99908661457b565b612da39190614567565b61245f91906145b8565b80471015612dfd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610ec9565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612e4a576040519150601f19603f3d011682016040523d82523d6000602084013e612e4f565b606091505b505090508061175f5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610ec9565b600081600054811015612f45576000818152600460205260409020547c01000000000000000000000000000000000000000000000000000000008116612f43575b80612a1f57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01600081815260046020526040902054612f07565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261175f908490613642565b600b80546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040805130606090811b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081166020808501919091523390921b1660348301526048808301889052835180840390910181526068830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a333200000000608884015260a4808401919091528351808403909101815260c4909201909252805191012060009084811461311a57600091505061245f565b6001600160a01b03831661312e8686613727565b6001600160a01b0316149695505050505050565b6015546fffffffffffffffffffffffffffffffff166131646001546000540390565b61316e908361454f565b11156131e25760405162461bcd60e51b815260206004820152602160248201527f5075726368617365206578636565647320617661696c61626c6520737570706c60448201527f79000000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b6131ec3382612bb1565b336000908152601960205260408120805483929061320b90849061454f565b909155505050565b6015546132469070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1682614688565b601a555050565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081526000906001600160a01b0385169063150b7a029061329b9033908990889088906004016144d8565b602060405180830381600087803b1580156132b557600080fd5b505af1925050508015613303575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252613300918101906141d9565b60015b613377573d808015613331576040519150601f19603f3d011682016040523d82523d6000602084013e613336565b606091505b50805161336f576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a020000000000000000000000000000000000000000000000000000000014905061245f565b60608161340257505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561342c57806134168161464f565b91506134259050600a83614567565b9150613406565b60008167ffffffffffffffff81111561344757613447614758565b6040519080825280601f01601f191660200182016040528015613471576020820181803683370190505b5090505b841561245f576134866001836145b8565b9150613493600a86614688565b61349e90603061454f565b60f81b8183815181106134b3576134b3614729565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506134ed600a86614567565b9450613475565b60006040518060800160405280604381526020016147d96043913980516020918201208351848301516040808701518051908601209051613554950193845260208401929092526001600160a01b03166040830152606082015260800190565b604051602081830303815290604052805190602001209050919050565b600061357c60095490565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201613554565b6135c6838361374b565b6001600160a01b0383163b1561175f576000548281035b6135f0600086838060010194508661324d565b613626576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8181106135dd57816000541461363b57600080fd5b5050505050565b6000613697826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166138759092919063ffffffff16565b80519091501561175f57808060200190518101906136b5919061417d565b61175f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610ec9565b60008060006137368585613884565b91509150613743816138f4565b509392505050565b60005481613785576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461383457808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a46001016137fc565b508161386c576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005550505050565b606061245f8484600085613ae5565b6000808251604114156138bb5760208301516040840151606085015160001a6138af87828585613c2d565b945094505050506138ed565b8251604014156138e557602083015160408401516138da868383613d38565b9350935050506138ed565b506000905060025b9250929050565b6000816004811115613908576139086146fa565b14156139115750565b6001816004811115613925576139256146fa565b14156139735760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610ec9565b6002816004811115613987576139876146fa565b14156139d55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ec9565b60038160048111156139e9576139e96146fa565b1415613a5d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b6004816004811115613a7157613a716146fa565b14156110fe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b606082471015613b5d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610ec9565b6001600160a01b0385163b613bb45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ec9565b600080866001600160a01b03168587604051613bd09190614368565b60006040518083038185875af1925050503d8060008114613c0d576040519150601f19603f3d011682016040523d82523d6000602084013e613c12565b606091505b5091509150613c22828286613d8a565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613c645750600090506003613d2f565b8460ff16601b14158015613c7c57508460ff16601c14155b15613c8d5750600090506004613d2f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613ce1573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001519150506001600160a01b038116613d2857600060019250925050613d2f565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681613d6e60ff86901c601b61454f565b9050613d7c87828885613c2d565b935093505050935093915050565b60608315613d99575081612a1f565b825115613da95782518084602001fd5b8160405162461bcd60e51b8152600401610ec9919061453c565b828054613dcf906145fb565b90600052602060002090601f016020900481019282613df15760008555613e37565b82601f10613e0a57805160ff1916838001178555613e37565b82800160010185558215613e37579182015b82811115613e37578251825591602001919060010190613e1c565b50613e43929150613e47565b5090565b5b80821115613e435760008155600101613e48565b600067ffffffffffffffff80841115613e7757613e77614758565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715613ebd57613ebd614758565b81604052809350858152868686011115613ed657600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112613f0157600080fd5b612a1f83833560208501613e5c565b600060208284031215613f2257600080fd5b8135612a1f81614787565b60008060408385031215613f4057600080fd5b8235613f4b81614787565b91506020830135613f5b81614787565b809150509250929050565b600080600060608486031215613f7b57600080fd5b8335613f8681614787565b92506020840135613f9681614787565b929592945050506040919091013590565b60008060008060808587031215613fbd57600080fd5b8435613fc881614787565b93506020850135613fd881614787565b925060408501359150606085013567ffffffffffffffff811115613ffb57600080fd5b61400787828801613ef0565b91505092959194509250565b6000806040838503121561402657600080fd5b823561403181614787565b91506020830135613f5b8161479c565b600080600080600060a0868803121561405957600080fd5b853561406481614787565b9450602086013567ffffffffffffffff81111561408057600080fd5b61408c88828901613ef0565b9450506040860135925060608601359150608086013560ff811681146140b157600080fd5b809150509295509295909350565b600080604083850312156140d257600080fd5b82356140dd81614787565b946020939093013593505050565b600080602083850312156140fe57600080fd5b823567ffffffffffffffff8082111561411657600080fd5b818501915085601f83011261412a57600080fd5b81358181111561413957600080fd5b8660208260051b850101111561414e57600080fd5b60209290920196919550909350505050565b60006020828403121561417257600080fd5b8135612a1f8161479c565b60006020828403121561418f57600080fd5b8151612a1f8161479c565b600080604083850312156141ad57600080fd5b50508035926020909101359150565b6000602082840312156141ce57600080fd5b8135612a1f816147aa565b6000602082840312156141eb57600080fd5b8151612a1f816147aa565b60006020828403121561420857600080fd5b8151612a1f81614787565b60006020828403121561422557600080fd5b813567ffffffffffffffff81111561423c57600080fd5b8201601f8101841361424d57600080fd5b61245f84823560208401613e5c565b60006020828403121561426e57600080fd5b81356fffffffffffffffffffffffffffffffff81168114612a1f57600080fd5b6000602082840312156142a057600080fd5b5035919050565b6000602082840312156142b957600080fd5b5051919050565b600080600080608085870312156142d657600080fd5b843593506020850135925060408501359150606085013567ffffffffffffffff811115613ffb57600080fd5b6000815180845261431a8160208601602086016145cf565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000815161435e8185602086016145cf565b9290920192915050565b6000825161437a8184602087016145cf565b9190910192915050565b600083516143968184602088016145cf565b60609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169190920190815260140192915050565b600080845481600182811c9150808316806143ea57607f831692505b6020808410821415614423577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015614437576001811461446657614493565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650614493565b60008b81526020902060005b8681101561448b5781548b820152908501908301614472565b505084890196505b5050505050506144a3818561434c565b95945050505050565b60006001600160a01b038086168352808516602084015250606060408301526144a36060830184614302565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261450a6080830184614302565b9695505050505050565b6001600160a01b03841681528260208201526060604082015260006144a36060830184614302565b602081526000612a1f6020830184614302565b600082198211156145625761456261469c565b500190565b600082614576576145766146cb565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156145b3576145b361469c565b500290565b6000828210156145ca576145ca61469c565b500390565b60005b838110156145ea5781810151838201526020016145d2565b838111156112395750506000910152565b600181811c9082168061460f57607f821691505b60208210811415614649577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156146815761468161469c565b5060010190565b600082614697576146976146cb565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6001600160a01b03811681146110fe57600080fd5b80151581146110fe57600080fd5b7fffffffff00000000000000000000000000000000000000000000000000000000811681146110fe57600080fdfe4d6574615472616e73616374696f6e2875696e74323536206e6f6e63652c616464726573732066726f6d2c62797465732066756e6374696f6e5369676e617475726529a26469706673582212204d479ebfb9cddb5d6c3eb67af163f8a51a3652cb9bd86163dc2f8f0e301c196864736f6c634300080700330000000000000000000000000000000000000000000000000000000000000100aa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca0000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1000000000000000000000000000000000000000000000000000000000000004a68747470733a2f2f75732d63656e7472616c312d6d656e6a6973776f726c642d616c6c6f776c6973742e636c6f756466756e6374696f6e732e6e65742f70726572657665616c3f69643d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007e9c4a00ce0967366a8c136d4e4b184e6c3333150000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a
Deployed Bytecode
0x60806040526004361061036f5760003560e01c8063762d3377116101c6578063bceae77b116100f7578063dc8c57b411610095578063efef39a11161006f578063efef39a114610b10578063f2fde38b14610b23578063ff1b655614610b43578063ffe630b514610b5857600080fd5b8063dc8c57b414610ac5578063e33b7de314610adb578063e985e9c514610af057600080fd5b8063c87b56dd116100d1578063c87b56dd14610a24578063ce7c2ac214610a44578063d3933ada14610a7a578063d79779b214610a8f57600080fd5b8063bceae77b146109bb578063bf34be44146109e4578063c54e73e314610a0457600080fd5b806395364a8411610164578063a22cb4651161013e578063a22cb46514610934578063abd0359614610954578063b88d4fde1461096e578063bc56602f1461098e57600080fd5b806395364a84146108ca57806395d89b41146108e95780639852595c146108fe57600080fd5b80638b83209b116101a05780638b83209b1461082f5780638d859f3e1461084f5780638da5cb5b1461088c57806394985ddd146108aa57600080fd5b8063762d3377146107de5780638342083a146107f1578063853828b61461081a57600080fd5b806332cb6b0c116102a057806355f804b31161023e5780636c19e783116102185780636c19e783146107695780636cf806901461078957806370a08231146107a9578063715018a6146107c957600080fd5b806355f804b3146106f95780635c975abb146107195780636352211e1461074957600080fd5b80633ae84a821161027a5780633ae84a8214610653578063406072a91461067357806342842e0e146106b957806348b75044146106d957600080fd5b806332cb6b0c146105cd5780633408e4701461062b5780633a98ef391461063e57600080fd5b8063163e1e611161030d57806319165587116102e7578063191655871461054257806320379ee51461056257806323b872dd146105775780632d0335ab1461059757600080fd5b8063163e1e61146104df57806316c38b3c146104ff57806318160ddd1461051f57600080fd5b8063095ea7b311610349578063095ea7b31461044c5780630c53c51c1461046e5780630f1876a2146104815780630f7e59701461049657600080fd5b806301ffc9a7146103bd57806306fdde03146103f2578063081812fc1461041457600080fd5b366103b8577f6ef95f06320e7a25a04a175ca677b7052bdd97131872c2192525a629f51be77033604080516001600160a01b0390921682523460208301520160405180910390a1005b600080fd5b3480156103c957600080fd5b506103dd6103d83660046141bc565b610b78565b60405190151581526020015b60405180910390f35b3480156103fe57600080fd5b50610407610c5d565b6040516103e9919061453c565b34801561042057600080fd5b5061043461042f36600461428e565b610cef565b6040516001600160a01b0390911681526020016103e9565b34801561045857600080fd5b5061046c6104673660046140bf565b610d4c565b005b61040761047c366004614041565b610e1d565b34801561048d57600080fd5b5061046c611046565b3480156104a257600080fd5b506104076040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b3480156104eb57600080fd5b5061046c6104fa3660046140eb565b611101565b34801561050b57600080fd5b5061046c61051a366004614160565b61123f565b34801561052b57600080fd5b50600154600054035b6040519081526020016103e9565b34801561054e57600080fd5b5061046c61055d366004613f10565b6112ae565b34801561056e57600080fd5b50600954610534565b34801561058357600080fd5b5061046c610592366004613f66565b611488565b3480156105a357600080fd5b506105346105b2366004613f10565b6001600160a01b03166000908152600a602052604090205490565b3480156105d957600080fd5b5060155461060a9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b6040516fffffffffffffffffffffffffffffffff90911681526020016103e9565b34801561063757600080fd5b5046610534565b34801561064a57600080fd5b50600e54610534565b34801561065f57600080fd5b5061046c61066e36600461425c565b6116b5565b34801561067f57600080fd5b5061053461068e366004613f2d565b6001600160a01b03918216600090815260146020908152604080832093909416825291909152205490565b3480156106c557600080fd5b5061046c6106d4366004613f66565b611744565b3480156106e557600080fd5b5061046c6106f4366004613f2d565b611764565b34801561070557600080fd5b5061046c610714366004614213565b611a11565b34801561072557600080fd5b50600b5474010000000000000000000000000000000000000000900460ff166103dd565b34801561075557600080fd5b5061043461076436600461428e565b611a82565b34801561077557600080fd5b5061046c610784366004613f10565b611a8d565b34801561079557600080fd5b5061046c6107a4366004614160565b611b21565b3480156107b557600080fd5b506105346107c4366004613f10565b611bac565b3480156107d557600080fd5b5061046c611c14565b61046c6107ec3660046142c0565b611c7a565b3480156107fd57600080fd5b5060155461060a906fffffffffffffffffffffffffffffffff1681565b34801561082657600080fd5b5061046c611e42565b34801561083b57600080fd5b5061043461084a36600461428e565b611eeb565b34801561085b57600080fd5b5060165461060a9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b34801561089857600080fd5b50600b546001600160a01b0316610434565b3480156108b657600080fd5b5061046c6108c536600461419a565b611f1b565b3480156108d657600080fd5b506017546103dd90610100900460ff1681565b3480156108f557600080fd5b50610407611f9d565b34801561090a57600080fd5b50610534610919366004613f10565b6001600160a01b031660009081526011602052604090205490565b34801561094057600080fd5b5061046c61094f366004614013565b611fac565b34801561096057600080fd5b506017546103dd9060ff1681565b34801561097a57600080fd5b5061046c610989366004613fa7565b612079565b34801561099a57600080fd5b506105346109a9366004613f10565b60196020526000908152604090205481565b3480156109c757600080fd5b5060165461060a906fffffffffffffffffffffffffffffffff1681565b3480156109f057600080fd5b5061046c6109ff36600461425c565b6120d6565b348015610a1057600080fd5b5061046c610a1f366004614160565b612173565b348015610a3057600080fd5b50610407610a3f36600461428e565b612204565b348015610a5057600080fd5b50610534610a5f366004613f10565b6001600160a01b031660009081526010602052604090205490565b348015610a8657600080fd5b5061046c6122b3565b348015610a9b57600080fd5b50610534610aaa366004613f10565b6001600160a01b031660009081526013602052604090205490565b348015610ad157600080fd5b50610534601a5481565b348015610ae757600080fd5b50600f54610534565b348015610afc57600080fd5b506103dd610b0b366004613f2d565b612360565b61046c610b1e36600461428e565b612467565b348015610b2f57600080fd5b5061046c610b3e366004613f10565b6126f1565b348015610b4f57600080fd5b506104076127d0565b348015610b6457600080fd5b5061046c610b73366004614213565b61285e565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083161480610c0b57507f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b80610c5757507f5b5e139f000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b606060028054610c6c906145fb565b80601f0160208091040260200160405190810160405280929190818152602001828054610c98906145fb565b8015610ce55780601f10610cba57610100808354040283529160200191610ce5565b820191906000526020600020905b815481529060010190602001808311610cc857829003601f168201915b5050505050905090565b6000610cfa826128cb565b610d30576040517fcf4700e400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610d5782611a82565b9050336001600160a01b03821614610da957610d738133612360565b610da9576040517fcfb3b94200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604080822080547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60408051606081810183526001600160a01b0388166000818152600a602090815290859020548452830152918101869052610e5b878287878761290b565b610ed25760405162461bcd60e51b815260206004820152602160248201527f5369676e657220616e64207369676e617475726520646f206e6f74206d61746360448201527f680000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b0387166000908152600a6020526040902054610ef6906001612a13565b6001600160a01b0388166000908152600a60205260409081902091909155517f5845892132946850460bff5a0083f71031bc5bf9aadcd40f1de79423eac9b10b90610f4690899033908a906144ac565b60405180910390a1600080306001600160a01b0316888a604051602001610f6e929190614384565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610fa691614368565b6000604051808303816000865af19150503d8060008114610fe3576040519150601f19603f3d011682016040523d82523d6000602084013e610fe8565b606091505b50915091508161103a5760405162461bcd60e51b815260206004820152601c60248201527f46756e6374696f6e2063616c6c206e6f74207375636365737366756c000000006044820152606401610ec9565b98975050505050505050565b600b546001600160a01b031633146110a05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601a54156110f05760405162461bcd60e51b815260206004820152601560248201527f4f666673657420697320616c72656164792073657400000000000000000000006044820152606401610ec9565b6110fe601f54601e54612a26565b50565b600b546001600160a01b0316331461115b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601554819070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff166111936001546000540390565b61119d908361454f565b11156111eb5760405162461bcd60e51b815260206004820152601860248201527f5f7175616e74697479206578636565647320737570706c7900000000000000006044820152606401610ec9565b60005b818110156112395761122784848381811061120b5761120b614729565b90506020020160208101906112209190613f10565b6001612bb1565b806112318161464f565b9150506111ee565b50505050565b600b546001600160a01b031633146112995760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b806112a6576110fe612bcb565b6110fe612c9d565b6001600160a01b0381166000908152601060205260409020546113395760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201527f73686172657300000000000000000000000000000000000000000000000000006064820152608401610ec9565b6000611344600f5490565b61134e904761454f565b9050600061137b8383611376866001600160a01b031660009081526011602052604090205490565b612d6f565b9050806113f05760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201527f647565207061796d656e740000000000000000000000000000000000000000006064820152608401610ec9565b6001600160a01b0383166000908152601160205260408120805483929061141890849061454f565b9250508190555080600f6000828254611431919061454f565b9091555061144190508382612dad565b604080516001600160a01b0385168152602081018390527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056910160405180910390a1505050565b600061149382612ec6565b9050836001600160a01b0316816001600160a01b0316146114e0576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b03881690911417611546576115108633612360565b611546576040517f59c896be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038516611586576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b801561159157600082555b6001600160a01b0386811660009081526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019055918716808252919020805460010190554260a01b177c0200000000000000000000000000000000000000000000000000000000176000858152600460205260409020557c0200000000000000000000000000000000000000000000000000000000831661166c576001840160008181526004602052604090205461166a57600054811461166a5760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b600b546001600160a01b0316331461170f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601680546fffffffffffffffffffffffffffffffff928316700100000000000000000000000000000000029216919091179055565b61175f83838360405180602001604052806000815250612079565b505050565b6001600160a01b0381166000908152601060205260409020546117ef5760405162461bcd60e51b815260206004820152602660248201527f5061796d656e7453706c69747465723a206163636f756e7420686173206e6f2060448201527f73686172657300000000000000000000000000000000000000000000000000006064820152608401610ec9565b6001600160a01b0382166000908152601360205260408120546040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038516906370a082319060240160206040518083038186803b15801561186057600080fd5b505afa158015611874573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189891906142a7565b6118a2919061454f565b905060006118db838361137687876001600160a01b03918216600090815260146020908152604080832093909416825291909152205490565b9050806119505760405162461bcd60e51b815260206004820152602b60248201527f5061796d656e7453706c69747465723a206163636f756e74206973206e6f742060448201527f647565207061796d656e740000000000000000000000000000000000000000006064820152608401610ec9565b6001600160a01b0380851660009081526014602090815260408083209387168352929052908120805483929061198790849061454f565b90915550506001600160a01b038416600090815260136020526040812080548392906119b490849061454f565b909155506119c59050848483612f77565b604080516001600160a01b038581168252602082018490528616917f3be5b7a71e84ed12875d241991c70855ac5817d847039e17a9d895c1ceb0f18a910160405180910390a250505050565b600b546001600160a01b03163314611a6b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b8051611a7e90601b906020840190613dc3565b5050565b6000610c5782612ec6565b600b546001600160a01b03163314611ae75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601d80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b600b546001600160a01b03163314611b7b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60006001600160a01b038216611bee576040517f8f4eb60400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506001600160a01b031660009081526005602052604090205467ffffffffffffffff1690565b600b546001600160a01b03163314611c6e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b611c786000612ff7565b565b600b5474010000000000000000000000000000000000000000900460ff1615611ce55760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ec9565b601d54611d00908490849084906001600160a01b0316613061565b611d4c5760405162461bcd60e51b815260206004820152601560248201527f50726573616c654d696e744e6f74416c6c6f77656400000000000000000000006044820152606401610ec9565b336000908152601960205260409020548390611d68908661454f565b1115611db65760405162461bcd60e51b815260206004820152601d60248201527f5175616e7469747920657863656564732077616c6c6574206c696d69740000006044820152606401610ec9565b6016543490611deb9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff168661457b565b1115611e395760405162461bcd60e51b815260206004820152601360248201527f4e6f7420656e6f756768206d696e6572616c73000000000000000000000000006044820152606401610ec9565b61123984613142565b600b546001600160a01b03163314611e9c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b60005b601c548110156110fe57611ed9601c8281548110611ebf57611ebf614729565b6000918252602090912001546001600160a01b03166112ae565b80611ee38161464f565b915050611e9f565b600060128281548110611f0057611f00614729565b6000918252602090912001546001600160a01b031692915050565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb79521614611f935760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c006044820152606401610ec9565b611a7e8282613213565b606060038054610c6c906145fb565b6001600160a01b038216331415611fef576040517fb06307db00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b0387168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b612084848484611488565b6001600160a01b0383163b15611239576120a08484848461324d565b611239576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b546001600160a01b031633146121305760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b601680547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b600b546001600160a01b031633146121cd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b60178054911515610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909216919091179055565b606061220f826128cb565b6122815760405162461bcd60e51b815260206004820152602860248201527f224552433732314d657461646174613a20746f6b656e496420646f6573206e6f60448201527f74206578697374220000000000000000000000000000000000000000000000006064820152608401610ec9565b601b61228c836133c2565b60405160200161229d9291906143ce565b6040516020818303038152906040529050919050565b600b546001600160a01b0316331461230d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b6015805470010000000000000000000000000000000081046fffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116179055565b6040517fc45527910000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301526000917f000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c191848116919083169063c45527919060240160206040518083038186803b1580156123e457600080fd5b505afa1580156123f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061241c91906141f6565b6001600160a01b03161415612435576001915050610c57565b6001600160a01b0380851660009081526007602090815260408083209387168352929052205460ff165b949350505050565b600b5474010000000000000000000000000000000000000000900460ff16156124d25760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ec9565b601754610100900460ff161561252a5760405162461bcd60e51b815260206004820152600d60248201527f50726573616c65206f6e6c792e000000000000000000000000000000000000006044820152606401610ec9565b6016546fffffffffffffffffffffffffffffffff168111156125b45760405162461bcd60e51b815260206004820152602260248201527f5175616e746974792065786365656473205055424c49435f4d494e545f4c494d60448201527f49540000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b60175460ff161561266557601654336000908152601960205260409020546fffffffffffffffffffffffffffffffff909116906125f1908361454f565b11156126655760405162461bcd60e51b815260206004820152602160248201527f5175616e746974792065786365656473207065722d77616c6c6574206c696d6960448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b601654349061269a9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff168361457b565b11156126e85760405162461bcd60e51b815260206004820152601360248201527f4e6f7420656e6f756768206d696e6572616c73000000000000000000000000006044820152606401610ec9565b6110fe81613142565b600b546001600160a01b0316331461274b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b6001600160a01b0381166127c75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610ec9565b6110fe81612ff7565b601880546127dd906145fb565b80601f0160208091040260200160405190810160405280929190818152602001828054612809906145fb565b80156128565780601f1061282b57610100808354040283529160200191612856565b820191906000526020600020905b81548152906001019060200180831161283957829003601f168201915b505050505081565b600b546001600160a01b031633146128b85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610ec9565b8051611a7e906018906020840190613dc3565b6000805482108015610c575750506000908152600460205260409020547c0100000000000000000000000000000000000000000000000000000000161590565b60006001600160a01b0386166129895760405162461bcd60e51b815260206004820152602560248201527f4e61746976654d6574615472616e73616374696f6e3a20494e56414c49445f5360448201527f49474e45520000000000000000000000000000000000000000000000000000006064820152608401610ec9565b600161299c612997876134f4565b613571565b6040805160008152602081018083529290925260ff851690820152606081018690526080810185905260a0016020604051602081039080840390855afa1580156129ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316866001600160a01b031614905095945050505050565b6000612a1f828461454f565b9392505050565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795284866000604051602001612a96929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b8152600401612ac393929190614514565b602060405180830381600087803b158015612add57600080fd5b505af1158015612af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b15919061417d565b506000838152600d6020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052612b7190600161454f565b6000858152600d602052604090205561245f8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b611a7e8282604051806020016040528060008152506135bc565b600b5474010000000000000000000000000000000000000000900460ff16612c355760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610ec9565b600b80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600b5474010000000000000000000000000000000000000000900460ff1615612d085760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610ec9565b600b80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612c803390565b600e546001600160a01b03841660009081526010602052604081205490918391612d99908661457b565b612da39190614567565b61245f91906145b8565b80471015612dfd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610ec9565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612e4a576040519150601f19603f3d011682016040523d82523d6000602084013e612e4f565b606091505b505090508061175f5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610ec9565b600081600054811015612f45576000818152600460205260409020547c01000000000000000000000000000000000000000000000000000000008116612f43575b80612a1f57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01600081815260046020526040902054612f07565b505b6040517fdf2d9b4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261175f908490613642565b600b80546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040805130606090811b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000009081166020808501919091523390921b1660348301526048808301889052835180840390910181526068830184528051908201207f19457468657265756d205369676e6564204d6573736167653a0a333200000000608884015260a4808401919091528351808403909101815260c4909201909252805191012060009084811461311a57600091505061245f565b6001600160a01b03831661312e8686613727565b6001600160a01b0316149695505050505050565b6015546fffffffffffffffffffffffffffffffff166131646001546000540390565b61316e908361454f565b11156131e25760405162461bcd60e51b815260206004820152602160248201527f5075726368617365206578636565647320617661696c61626c6520737570706c60448201527f79000000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b6131ec3382612bb1565b336000908152601960205260408120805483929061320b90849061454f565b909155505050565b6015546132469070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1682614688565b601a555050565b6040517f150b7a020000000000000000000000000000000000000000000000000000000081526000906001600160a01b0385169063150b7a029061329b9033908990889088906004016144d8565b602060405180830381600087803b1580156132b557600080fd5b505af1925050508015613303575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252613300918101906141d9565b60015b613377573d808015613331576040519150601f19603f3d011682016040523d82523d6000602084013e613336565b606091505b50805161336f576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a020000000000000000000000000000000000000000000000000000000014905061245f565b60608161340257505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561342c57806134168161464f565b91506134259050600a83614567565b9150613406565b60008167ffffffffffffffff81111561344757613447614758565b6040519080825280601f01601f191660200182016040528015613471576020820181803683370190505b5090505b841561245f576134866001836145b8565b9150613493600a86614688565b61349e90603061454f565b60f81b8183815181106134b3576134b3614729565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506134ed600a86614567565b9450613475565b60006040518060800160405280604381526020016147d96043913980516020918201208351848301516040808701518051908601209051613554950193845260208401929092526001600160a01b03166040830152606082015260800190565b604051602081830303815290604052805190602001209050919050565b600061357c60095490565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201613554565b6135c6838361374b565b6001600160a01b0383163b1561175f576000548281035b6135f0600086838060010194508661324d565b613626576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8181106135dd57816000541461363b57600080fd5b5050505050565b6000613697826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166138759092919063ffffffff16565b80519091501561175f57808060200190518101906136b5919061417d565b61175f5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610ec9565b60008060006137368585613884565b91509150613743816138f4565b509392505050565b60005481613785576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a4600183015b81811461383457808360007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a46001016137fc565b508161386c576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005550505050565b606061245f8484600085613ae5565b6000808251604114156138bb5760208301516040840151606085015160001a6138af87828585613c2d565b945094505050506138ed565b8251604014156138e557602083015160408401516138da868383613d38565b9350935050506138ed565b506000905060025b9250929050565b6000816004811115613908576139086146fa565b14156139115750565b6001816004811115613925576139256146fa565b14156139735760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610ec9565b6002816004811115613987576139876146fa565b14156139d55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610ec9565b60038160048111156139e9576139e96146fa565b1415613a5d5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b6004816004811115613a7157613a716146fa565b14156110fe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401610ec9565b606082471015613b5d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610ec9565b6001600160a01b0385163b613bb45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610ec9565b600080866001600160a01b03168587604051613bd09190614368565b60006040518083038185875af1925050503d8060008114613c0d576040519150601f19603f3d011682016040523d82523d6000602084013e613c12565b606091505b5091509150613c22828286613d8a565b979650505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613c645750600090506003613d2f565b8460ff16601b14158015613c7c57508460ff16601c14155b15613c8d5750600090506004613d2f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613ce1573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001519150506001600160a01b038116613d2857600060019250925050613d2f565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831681613d6e60ff86901c601b61454f565b9050613d7c87828885613c2d565b935093505050935093915050565b60608315613d99575081612a1f565b825115613da95782518084602001fd5b8160405162461bcd60e51b8152600401610ec9919061453c565b828054613dcf906145fb565b90600052602060002090601f016020900481019282613df15760008555613e37565b82601f10613e0a57805160ff1916838001178555613e37565b82800160010185558215613e37579182015b82811115613e37578251825591602001919060010190613e1c565b50613e43929150613e47565b5090565b5b80821115613e435760008155600101613e48565b600067ffffffffffffffff80841115613e7757613e77614758565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715613ebd57613ebd614758565b81604052809350858152868686011115613ed657600080fd5b858560208301376000602087830101525050509392505050565b600082601f830112613f0157600080fd5b612a1f83833560208501613e5c565b600060208284031215613f2257600080fd5b8135612a1f81614787565b60008060408385031215613f4057600080fd5b8235613f4b81614787565b91506020830135613f5b81614787565b809150509250929050565b600080600060608486031215613f7b57600080fd5b8335613f8681614787565b92506020840135613f9681614787565b929592945050506040919091013590565b60008060008060808587031215613fbd57600080fd5b8435613fc881614787565b93506020850135613fd881614787565b925060408501359150606085013567ffffffffffffffff811115613ffb57600080fd5b61400787828801613ef0565b91505092959194509250565b6000806040838503121561402657600080fd5b823561403181614787565b91506020830135613f5b8161479c565b600080600080600060a0868803121561405957600080fd5b853561406481614787565b9450602086013567ffffffffffffffff81111561408057600080fd5b61408c88828901613ef0565b9450506040860135925060608601359150608086013560ff811681146140b157600080fd5b809150509295509295909350565b600080604083850312156140d257600080fd5b82356140dd81614787565b946020939093013593505050565b600080602083850312156140fe57600080fd5b823567ffffffffffffffff8082111561411657600080fd5b818501915085601f83011261412a57600080fd5b81358181111561413957600080fd5b8660208260051b850101111561414e57600080fd5b60209290920196919550909350505050565b60006020828403121561417257600080fd5b8135612a1f8161479c565b60006020828403121561418f57600080fd5b8151612a1f8161479c565b600080604083850312156141ad57600080fd5b50508035926020909101359150565b6000602082840312156141ce57600080fd5b8135612a1f816147aa565b6000602082840312156141eb57600080fd5b8151612a1f816147aa565b60006020828403121561420857600080fd5b8151612a1f81614787565b60006020828403121561422557600080fd5b813567ffffffffffffffff81111561423c57600080fd5b8201601f8101841361424d57600080fd5b61245f84823560208401613e5c565b60006020828403121561426e57600080fd5b81356fffffffffffffffffffffffffffffffff81168114612a1f57600080fd5b6000602082840312156142a057600080fd5b5035919050565b6000602082840312156142b957600080fd5b5051919050565b600080600080608085870312156142d657600080fd5b843593506020850135925060408501359150606085013567ffffffffffffffff811115613ffb57600080fd5b6000815180845261431a8160208601602086016145cf565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000815161435e8185602086016145cf565b9290920192915050565b6000825161437a8184602087016145cf565b9190910192915050565b600083516143968184602088016145cf565b60609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000169190920190815260140192915050565b600080845481600182811c9150808316806143ea57607f831692505b6020808410821415614423577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015614437576001811461446657614493565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650614493565b60008b81526020902060005b8681101561448b5781548b820152908501908301614472565b505084890196505b5050505050506144a3818561434c565b95945050505050565b60006001600160a01b038086168352808516602084015250606060408301526144a36060830184614302565b60006001600160a01b0380871683528086166020840152508360408301526080606083015261450a6080830184614302565b9695505050505050565b6001600160a01b03841681528260208201526060604082015260006144a36060830184614302565b602081526000612a1f6020830184614302565b600082198211156145625761456261469c565b500190565b600082614576576145766146cb565b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156145b3576145b361469c565b500290565b6000828210156145ca576145ca61469c565b500390565b60005b838110156145ea5781810151838201526020016145d2565b838111156112395750506000910152565b600181811c9082168061460f57607f821691505b60208210811415614649577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156146815761468161469c565b5060010190565b600082614697576146976146cb565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6001600160a01b03811681146110fe57600080fd5b80151581146110fe57600080fd5b7fffffffff00000000000000000000000000000000000000000000000000000000811681146110fe57600080fdfe4d6574615472616e73616374696f6e2875696e74323536206e6f6e63652c616464726573732066726f6d2c62797465732066756e6374696f6e5369676e617475726529a26469706673582212204d479ebfb9cddb5d6c3eb67af163f8a51a3652cb9bd86163dc2f8f0e301c196864736f6c63430008070033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000100aa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca0000000000000000000000000000000000000000000000001bc16d674ec80000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1000000000000000000000000000000000000000000000000000000000000004a68747470733a2f2f75732d63656e7472616c312d6d656e6a6973776f726c642d616c6c6f776c6973742e636c6f756466756e6374696f6e732e6e65742f70726572657665616c3f69643d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007e9c4a00ce0967366a8c136d4e4b184e6c3333150000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a
-----Decoded View---------------
Arg [0] : _uri (string): https://us-central1-menjisworld-allowlist.cloudfunctions.net/prereveal?id=
Arg [1] : _keyHash (bytes32): 0xaa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445
Arg [2] : _vrfCoordinator (address): 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952
Arg [3] : _linkToken (address): 0x514910771AF9Ca656af840dff83E8264EcF986CA
Arg [4] : _linkFee (uint256): 2000000000000000000
Arg [5] : _payees (address[]): 0x7E9c4a00Ce0967366A8C136D4e4b184E6c333315
Arg [6] : _shares (uint256[]): 10
Arg [7] : proxyRegistryAddress (address): 0xa5409ec958C83C3f309868babACA7c86DCB077c1
-----Encoded View---------------
16 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [1] : aa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af445
Arg [2] : 000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb7952
Arg [3] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Arg [4] : 0000000000000000000000000000000000000000000000001bc16d674ec80000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [6] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [7] : 000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1
Arg [8] : 000000000000000000000000000000000000000000000000000000000000004a
Arg [9] : 68747470733a2f2f75732d63656e7472616c312d6d656e6a6973776f726c642d
Arg [10] : 616c6c6f776c6973742e636c6f756466756e6374696f6e732e6e65742f707265
Arg [11] : 72657665616c3f69643d00000000000000000000000000000000000000000000
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [13] : 0000000000000000000000007e9c4a00ce0967366a8c136d4e4b184e6c333315
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [15] : 000000000000000000000000000000000000000000000000000000000000000a
Loading...
Loading
Loading...
Loading
OVERVIEW
Menji’s World is an artist-founded project built with the intention to construct unique experiences, bend the limitations of fashion, and be an example that anyone can create a world that is unique to themselves and inclusive to those who care to explore it. Within Menji’s Wor...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.