Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 24 from a total of 24 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Transfer Ownersh... | 23481233 | 146 days ago | IN | 0 ETH | 0.00003291 | ||||
| Mint Reserve | 23442989 | 152 days ago | IN | 0.0141 ETH | 0.00001091 | ||||
| Mint Reserve | 23442953 | 152 days ago | IN | 0.0188 ETH | 0.00001037 | ||||
| Mint Reserve | 23442904 | 152 days ago | IN | 0.0188 ETH | 0.00001189 | ||||
| Mint Reserve | 22390795 | 299 days ago | IN | 0.0005 ETH | 0.0000393 | ||||
| Mint Reserve | 22333662 | 307 days ago | IN | 0.0005 ETH | 0.00002195 | ||||
| Mint Reserve | 22333631 | 307 days ago | IN | 0.0005 ETH | 0.0000177 | ||||
| Mint Reserve | 22333323 | 307 days ago | IN | 0.0005 ETH | 0.00003326 | ||||
| Mint Reserve | 22297314 | 312 days ago | IN | 0.0005 ETH | 0.00000751 | ||||
| Mint Reserve | 22297282 | 312 days ago | IN | 0.0005 ETH | 0.00000933 | ||||
| Mint Reserve | 22185817 | 328 days ago | IN | 0.0005 ETH | 0.00000832 | ||||
| Mint Reserve | 22185816 | 328 days ago | IN | 0.0005 ETH | 0.00000791 | ||||
| Mint Reserve | 22173413 | 329 days ago | IN | 0.0005 ETH | 0.00002613 | ||||
| Mint Reserve | 22173231 | 329 days ago | IN | 0.0005 ETH | 0.00001677 | ||||
| Mint Reserve | 22173230 | 329 days ago | IN | 0.0005 ETH | 0.00001608 | ||||
| Mint Reserve | 22092937 | 340 days ago | IN | 0.0005 ETH | 0.00000944 | ||||
| Mint Reserve | 22090470 | 341 days ago | IN | 0.0005 ETH | 0.00000885 | ||||
| Mint Reserve | 22078548 | 342 days ago | IN | 0.0005 ETH | 0.0000091 | ||||
| Mint Reserve | 22076106 | 343 days ago | IN | 0.0005 ETH | 0.00000915 | ||||
| Mint Reserve | 22068655 | 344 days ago | IN | 0.0005 ETH | 0.00002357 | ||||
| Mint Reserve | 22055300 | 346 days ago | IN | 0.0005 ETH | 0.00000932 | ||||
| Mint Reserve | 22048425 | 347 days ago | IN | 0.0005 ETH | 0.00001188 | ||||
| Mint Reserve | 22019701 | 351 days ago | IN | 0.0005 ETH | 0.00002376 | ||||
| Mint Reserve | 22006121 | 353 days ago | IN | 0 ETH | 0.00002404 |
Latest 16 internal transactions
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.001 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.001 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.001 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0015 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0005 ETH | ||||
| Transfer | 23484878 | 146 days ago | 0.0517 ETH | ||||
| 0x60806040 | 23481187 | 146 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ERC1155Serendipity
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
// solhint-disable reason-string
pragma solidity ^0.8.0;
import "@manifoldxyz/creator-core-solidity/contracts/core/IERC1155CreatorCore.sol";
import "@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol";
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "./Serendipity.sol";
import "./IERC1155Serendipity.sol";
/**
* @title Serendipity Lazy Payable Claim - ERC-1155
* @author manifold.xyz
* @notice
*/
contract ERC1155Serendipity is IERC165, IERC1155Serendipity, ICreatorExtensionTokenURI, Serendipity {
using Strings for uint256;
// stores mapping from contractAddress/instanceId to the claim it represents
// { contractAddress => { instanceId => Claim } }
mapping(address => mapping(uint256 => Claim)) private _claims;
// { contractAddress => { tokenId => { instanceId } }
mapping(address => mapping(uint256 => uint256)) private _tokenInstances;
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, AdminControl) returns (bool) {
return
interfaceId == type(IERC1155Serendipity).interfaceId ||
interfaceId == type(ISerendipity).interfaceId ||
interfaceId == type(ICreatorExtensionTokenURI).interfaceId ||
interfaceId == type(IAdminControl).interfaceId ||
interfaceId == type(IERC165).interfaceId;
}
constructor(address initialOwner) Serendipity(initialOwner) {}
/**
* See {IERC1155Serendipity-initializeClaim}.
*/
function initializeClaim(
address creatorContractAddress,
uint256 instanceId,
ClaimParameters calldata claimParameters
) external payable override creatorAdminRequired(creatorContractAddress) {
if (deprecated) {
revert ContractDeprecated();
}
if (instanceId == 0 || instanceId > MAX_UINT_56) revert ISerendipity.InvalidInstance();
if (_claims[creatorContractAddress][instanceId].storageProtocol != StorageProtocol.INVALID)
revert ISerendipity.ClaimAlreadyInitialized();
// Checks
if (claimParameters.storageProtocol == StorageProtocol.INVALID) revert ISerendipity.InvalidStorageProtocol();
if (claimParameters.endDate != 0 && claimParameters.startDate >= claimParameters.endDate)
revert ISerendipity.InvalidDate();
if (claimParameters.totalMax > MAX_UINT_32) revert ISerendipity.InvalidInput();
if (claimParameters.tokenVariations > MAX_UINT_8) revert ISerendipity.InvalidInput();
if (claimParameters.cost > MAX_UINT_96) revert ISerendipity.InvalidInput();
address[] memory receivers = new address[](1);
receivers[0] = msg.sender;
uint256[] memory amounts = new uint256[](claimParameters.tokenVariations);
string[] memory uris = new string[](claimParameters.tokenVariations);
uint256[] memory newTokenIds = IERC1155CreatorCore(creatorContractAddress).mintExtensionNew(receivers, amounts, uris);
if (newTokenIds[0] > MAX_UINT_80) revert ISerendipity.InvalidStartingTokenId();
// Create the claim
_claims[creatorContractAddress][instanceId] = Claim({
storageProtocol: claimParameters.storageProtocol,
total: 0,
totalMax: claimParameters.totalMax,
startDate: claimParameters.startDate,
endDate: claimParameters.endDate,
startingTokenId: uint80(newTokenIds[0]),
tokenVariations: claimParameters.tokenVariations,
location: claimParameters.location,
paymentReceiver: claimParameters.paymentReceiver,
cost: claimParameters.cost,
erc20: claimParameters.erc20
});
for (uint256 i; i < claimParameters.tokenVariations; ) {
_tokenInstances[creatorContractAddress][newTokenIds[i]] = instanceId;
unchecked {
++i;
}
}
emit SerendipityClaimInitialized(creatorContractAddress, instanceId, msg.sender);
}
/**
* See {IERC1155Serendipity-updateClaim}.
*/
function updateClaim(
address creatorContractAddress,
uint256 instanceId,
UpdateClaimParameters memory updateClaimParameters
) external override creatorAdminRequired(creatorContractAddress) {
if (deprecated) {
revert ContractDeprecated();
}
Claim memory claim = _getClaim(creatorContractAddress, instanceId);
if (instanceId == 0 || instanceId > MAX_UINT_56) revert ISerendipity.InvalidInstance();
if (updateClaimParameters.endDate != 0 && updateClaimParameters.startDate >= updateClaimParameters.endDate)
revert ISerendipity.InvalidDate();
if (updateClaimParameters.totalMax != 0 && updateClaimParameters.totalMax < claim.total) revert ISerendipity.CannotLowerTotalMaxBeyondTotal();
if (updateClaimParameters.totalMax > MAX_UINT_32) revert ISerendipity.InvalidInput();
if (updateClaimParameters.storageProtocol == StorageProtocol.INVALID) revert ISerendipity.InvalidStorageProtocol();
if (updateClaimParameters.cost > MAX_UINT_96) revert ISerendipity.InvalidInput();
// Overwrite the existing values
_claims[creatorContractAddress][instanceId] = Claim({
storageProtocol: updateClaimParameters.storageProtocol,
total: claim.total,
totalMax: updateClaimParameters.totalMax,
startDate: updateClaimParameters.startDate,
endDate: updateClaimParameters.endDate,
startingTokenId: claim.startingTokenId,
tokenVariations: claim.tokenVariations,
location: updateClaimParameters.location,
paymentReceiver: updateClaimParameters.paymentReceiver,
cost: updateClaimParameters.cost,
erc20: claim.erc20
});
emit SerendipityClaimUpdated(creatorContractAddress, instanceId);
}
/**
* See {IERC1155Serendipity-getClaim}.
*/
function getClaim(address creatorContractAddress, uint256 instanceId) public view override returns (Claim memory) {
return _getClaim(creatorContractAddress, instanceId);
}
/**
* See {IERC1155Serendipity-getClaimForToken}.
*/
function getClaimForToken(
address creatorContractAddress,
uint256 tokenId
) external view override returns (uint256 instanceId, Claim memory claim) {
instanceId = _tokenInstances[creatorContractAddress][tokenId];
claim = _getClaim(creatorContractAddress, instanceId);
}
function _getClaim(address creatorContractAddress, uint256 instanceId) private view returns (Claim storage claim) {
claim = _claims[creatorContractAddress][instanceId];
if (claim.storageProtocol == StorageProtocol.INVALID) revert ISerendipity.ClaimNotInitialized();
}
/**
* See {ISerendipity-mintReserve}.
*/
function mintReserve(address creatorContractAddress, uint256 instanceId, uint32 mintCount) external payable override {
if (Address.isContract(msg.sender)) revert ISerendipity.CannotMintFromContract();
Claim storage claim = _getClaim(creatorContractAddress, instanceId);
// Checks for reserving
if (mintCount == 0 || mintCount >= MAX_UINT_32) revert ISerendipity.InvalidMintCount();
if (claim.startDate > block.timestamp || (claim.endDate > 0 && claim.endDate < block.timestamp))
revert ISerendipity.ClaimInactive();
if (claim.totalMax != 0 && claim.total == claim.totalMax) revert ISerendipity.ClaimSoldOut();
if (claim.total == MAX_UINT_32) revert ISerendipity.TooManyRequested();
if (msg.value != (claim.cost + MINT_FEE) * mintCount) revert ISerendipity.InvalidPayment();
// calculate the amount to reserve and update totals
uint32 amountToReserve = mintCount;
if (claim.totalMax != 0) {
amountToReserve = uint32(Math.min(mintCount, claim.totalMax - claim.total));
}
claim.total += amountToReserve;
_mintDetailsPerWallet[creatorContractAddress][instanceId][msg.sender].reservedCount += amountToReserve;
if (claim.cost > 0) {
_sendFunds(claim.paymentReceiver, claim.cost * amountToReserve);
}
// Refund any overpayment
if (amountToReserve != mintCount) {
uint256 refundAmount = msg.value - (claim.cost + MINT_FEE) * amountToReserve;
_sendFunds(payable(msg.sender), refundAmount);
}
emit SerendipityMintReserved(creatorContractAddress, instanceId, msg.sender, amountToReserve);
}
/**
* See {ISerendipity-deliverMints}.
*/
function deliverMints(ISerendipity.ClaimMint[] calldata mints) external override {
_validateSigner();
for (uint256 i; i < mints.length; ) {
ClaimMint calldata mintData = mints[i];
Claim memory claim = _getClaim(mintData.creatorContractAddress, mintData.instanceId);
address[] memory receivers = new address[](mintData.variationMints.length);
uint256[] memory amounts = new uint256[](mintData.variationMints.length);
uint256[] memory tokenIds = new uint256[](mintData.variationMints.length);
for (uint256 j; j < mintData.variationMints.length; ) {
VariationMint calldata variationMint = mintData.variationMints[j];
if (variationMint.variationIndex > MAX_UINT_8) revert ISerendipity.InvalidVariationIndex();
uint8 variationIndex = variationMint.variationIndex;
if (variationIndex > claim.tokenVariations || variationIndex < 1) revert ISerendipity.InvalidVariationIndex();
address recipient = variationMint.recipient;
if (variationMint.amount > MAX_UINT_32) revert ISerendipity.TooManyRequested();
uint32 amount = variationMint.amount;
UserMintDetails storage userMintDetails = _mintDetailsPerWallet[mintData.creatorContractAddress][
mintData.instanceId
][recipient];
if (userMintDetails.deliveredCount + amount > userMintDetails.reservedCount)
revert ISerendipity.CannotMintMoreThanReserved();
if (claim.startingTokenId > MAX_UINT_80) revert ISerendipity.InvalidStartingTokenId();
tokenIds[j] = claim.startingTokenId + variationIndex - 1;
amounts[j] = amount;
receivers[j] = recipient;
userMintDetails.deliveredCount += amount;
unchecked {
j++;
}
}
IERC1155CreatorCore(mintData.creatorContractAddress).mintExtensionExisting(receivers, tokenIds, amounts);
unchecked {
i++;
}
}
}
/**
* See {ISerendipity-getUserMints}.
*/
function getUserMints(
address minter,
address creatorContractAddress,
uint256 instanceId
) external view override returns (UserMintDetails memory) {
return _getUserMints(minter, creatorContractAddress, instanceId);
}
/**
* See {ICreatorExtensionTokenURI-tokenURI}.
*/
function tokenURI(address creatorContractAddress, uint256 tokenId) external view override returns (string memory uri) {
uint256 instanceId = _tokenInstances[creatorContractAddress][tokenId];
if (instanceId == 0) revert ISerendipity.TokenDNE();
Claim memory claim = _getClaim(creatorContractAddress, instanceId);
string memory prefix = "";
if (claim.storageProtocol == StorageProtocol.ARWEAVE) {
prefix = ARWEAVE_PREFIX;
} else if (claim.storageProtocol == StorageProtocol.IPFS) {
prefix = IPFS_PREFIX;
}
uri = string(abi.encodePacked(prefix, claim.location, "/", Strings.toString(tokenId - claim.startingTokenId + 1)));
}
/**
* See {IERC1155Serendipity-updateTokenURIParams}.
*/
function updateTokenURIParams(
address creatorContractAddress,
uint256 instanceId,
StorageProtocol storageProtocol,
string calldata location
) external override creatorAdminRequired(creatorContractAddress) {
Claim storage claim = _getClaim(creatorContractAddress, instanceId);
if (storageProtocol == StorageProtocol.INVALID) revert ISerendipity.InvalidStorageProtocol();
claim.storageProtocol = storageProtocol;
claim.location = location;
emit SerendipityClaimUpdated(creatorContractAddress, instanceId);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "./CreatorCore.sol";
/**
* @dev Core ERC1155 creator interface
*/
interface IERC1155CreatorCore is ICreatorCore {
/**
* @dev mint a token with no extension. Can only be called by an admin.
*
* @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
* @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array
* @param uris - If no elements, all tokens use the default uri.
* If any element is an empty string, the corresponding token uses the default uri.
*
*
* Requirements: If to is a multi-element array, then uris must be empty or single element array
* If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size
* If to is a single element array, uris must be empty or the same length as amounts
*
* Examples:
* mintBaseNew(['0x....1', '0x....2'], [1], [])
* Mints a single new token, and gives 1 each to '0x....1' and '0x....2'. Token uses default uri.
*
* mintBaseNew(['0x....1', '0x....2'], [1, 2], [])
* Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'. Token uses default uri.
*
* mintBaseNew(['0x....1'], [1, 2], ["", "http://token2.com"])
* Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second. 1st token uses default uri, second uses "http://token2.com".
*
* @return Returns list of tokenIds minted
*/
function mintBaseNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);
/**
* @dev batch mint existing token with no extension. Can only be called by an admin.
*
* @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
* @param tokenIds - Can be a single element array (all recipients get the same token) or a multi-element array
* @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array
*
* Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays
*
* Examples:
* mintBaseExisting(['0x....1', '0x....2'], [1], [10])
* Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.
*
* mintBaseExisting(['0x....1', '0x....2'], [1, 2], [10, 20])
* Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.
*
* mintBaseExisting(['0x....1'], [1, 2], [10, 20])
* Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.
*
* mintBaseExisting(['0x....1', '0x....2'], [1], [10, 20])
* Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.
*
*/
function mintBaseExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
/**
* @dev mint a token from an extension. Can only be called by a registered extension.
*
* @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
* @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array
* @param uris - If no elements, all tokens use the default uri.
* If any element is an empty string, the corresponding token uses the default uri.
*
*
* Requirements: If to is a multi-element array, then uris must be empty or single element array
* If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size
* If to is a single element array, uris must be empty or the same length as amounts
*
* Examples:
* mintExtensionNew(['0x....1', '0x....2'], [1], [])
* Mints a single new token, and gives 1 each to '0x....1' and '0x....2'. Token uses default uri.
*
* mintExtensionNew(['0x....1', '0x....2'], [1, 2], [])
* Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'. Token uses default uri.
*
* mintExtensionNew(['0x....1'], [1, 2], ["", "http://token2.com"])
* Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second. 1st token uses default uri, second uses "http://token2.com".
*
* @return Returns list of tokenIds minted
*/
function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);
/**
* @dev batch mint existing token from extension. Can only be called by a registered extension.
*
* @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients)
* @param tokenIds - Can be a single element array (all recipients get the same token) or a multi-element array
* @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array
*
* Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays
*
* Examples:
* mintExtensionExisting(['0x....1', '0x....2'], [1], [10])
* Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'.
*
* mintExtensionExisting(['0x....1', '0x....2'], [1, 2], [10, 20])
* Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'.
*
* mintExtensionExisting(['0x....1'], [1, 2], [10, 20])
* Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'.
*
* mintExtensionExisting(['0x....1', '0x....2'], [1], [10, 20])
* Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'.
*
*/
function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
/**
* @dev burn tokens. Can only be called by token owner or approved address.
* On burn, calls back to the registered extension's onBurn method
*/
function burn(address account, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
/**
* @dev Total amount of tokens in with a given tokenId.
*/
function totalSupply(uint256 tokenId) external view returns (uint256);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
/**
* @dev Implement this if you want your extension to have overloadable URI's
*/
interface ICreatorExtensionTokenURI is IERC165 {
/**
* Get the uri for a given creator/tokenId
*/
function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// solhint-disable reason-string
pragma solidity ^0.8.0;
import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
import "./ISerendipity.sol";
/**
* @title Serendipity Lazy Claim
* @author manifold.xyz
*/
abstract contract Serendipity is ISerendipity, AdminControl {
using EnumerableSet for EnumerableSet.AddressSet;
string internal constant ARWEAVE_PREFIX = "https://arweave.net/";
string internal constant IPFS_PREFIX = "ipfs://";
address internal _signer;
uint256 internal constant MAX_UINT_8 = 0xff;
uint256 internal constant MAX_UINT_32 = 0xffffffff;
uint256 internal constant MAX_UINT_48 = 0xffffffffffff;
uint256 internal constant MAX_UINT_56 = 0xffffffffffffff;
uint256 internal constant MAX_UINT_80 = 0xffffffffffffffffffff;
uint256 internal constant MAX_UINT_96 = 0xffffffffffffffffffffffff;
address internal constant ADDRESS_ZERO = 0x0000000000000000000000000000000000000000;
uint256 public constant MINT_FEE = 500000000000000;
bool public deprecated;
// { contractAddress => { instanceId => { walletAddress => UserMintDetails } } }
mapping(address => mapping(uint256 => mapping(address => UserMintDetails))) internal _mintDetailsPerWallet;
/**
* @notice This extension is shared, not single-creator. So we must ensure
* that a claim's initializer is an admin on the creator contract
* @param creatorContractAddress the address of the creator contract to check the admin against
*/
modifier creatorAdminRequired(address creatorContractAddress) {
AdminControl creatorCoreContract = AdminControl(creatorContractAddress);
require(creatorCoreContract.isAdmin(msg.sender), "Wallet is not an administrator for contract");
_;
}
constructor(address initialOwner) {
_transferOwnership(initialOwner);
}
/**
* Admin function to deprecate the contract
*/
function deprecate(bool _deprecated) external adminRequired {
deprecated = _deprecated;
}
/**
* See {ISerendipity-withdraw}.
*/
function withdraw(address payable receiver, uint256 amount) external override adminRequired {
(bool sent, ) = receiver.call{ value: amount }("");
if (!sent) revert ISerendipity.FailedToTransfer();
}
/**
* See {ISerendipity-setSigner}.
*/
function setSigner(address signer) external override adminRequired {
_signer = signer;
}
function _validateSigner() internal view {
if (msg.sender != _signer) revert ISerendipity.InvalidSignature();
}
function _getUserMints(
address minter,
address creatorContractAddress,
uint256 instanceId
) internal view returns (UserMintDetails memory) {
return (_mintDetailsPerWallet[creatorContractAddress][instanceId][minter]);
}
function _sendFunds(address payable recipient, uint256 amount) internal {
if (recipient == ADDRESS_ZERO) revert FailedToTransfer();
(bool sent, ) = recipient.call{ value: amount }("");
if (!sent) revert FailedToTransfer();
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "./ISerendipity.sol";
/**
* Serendipity Lazy Claim interface for ERC-1155
*/
interface IERC1155Serendipity is ISerendipity {
struct Claim {
StorageProtocol storageProtocol;
uint32 total;
uint32 totalMax;
uint48 startDate;
uint48 endDate;
uint80 startingTokenId;
uint8 tokenVariations;
string location;
address payable paymentReceiver;
uint96 cost;
address erc20;
}
struct ClaimParameters {
StorageProtocol storageProtocol;
uint32 totalMax;
uint48 startDate;
uint48 endDate;
uint8 tokenVariations;
string location;
address payable paymentReceiver;
uint96 cost;
address erc20;
}
struct UpdateClaimParameters {
StorageProtocol storageProtocol;
address payable paymentReceiver;
uint32 totalMax;
uint48 startDate;
uint48 endDate;
uint96 cost;
string location;
}
/**
* @notice initialize a new claim, emit initialize event
* @param creatorContractAddress the creator contract the claim will mint tokens for
* @param instanceId the claim instanceId for the creator contract
* @param claimParameters the parameters which will affect the minting behavior of the claim
*/
function initializeClaim(
address creatorContractAddress,
uint256 instanceId,
ClaimParameters calldata claimParameters
) external payable;
/**
* @notice update an existing claim at instanceId
* @param creatorContractAddress the creator contract corresponding to the claim
* @param instanceId the claim instanceId for the creator contract
* @param updateClaimParameters the updateable parameters that affect the minting behavior of the claim
*/
function updateClaim(
address creatorContractAddress,
uint256 instanceId,
UpdateClaimParameters calldata updateClaimParameters
) external;
/**
* @notice get a claim corresponding to a creator contract and instanceId
* @param creatorContractAddress the address of the creator contract
* @param instanceId the claim instanceId for the creator contract
* @return the claim object
*/
function getClaim(address creatorContractAddress, uint256 instanceId) external view returns (Claim memory);
/**
* @notice get a claim corresponding to a token
* @param creatorContractAddress the address of the creator contract
* @param tokenId the tokenId of the claim
* @return the claim instanceId and claim object
*/
function getClaimForToken(address creatorContractAddress, uint256 tokenId) external view returns (uint256, Claim memory);
/**
* @notice update tokenURI for an existing token
* @param creatorContractAddress the creator contract corresponding to the burn redeem
* @param instanceId the instanceId of the burnRedeem for the creator contract
* @param storageProtocol the storage protocol for the metadata
* @param location the location of the metadata
*/
function updateTokenURIParams(
address creatorContractAddress,
uint256 instanceId,
StorageProtocol storageProtocol,
string calldata location
) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "../extensions/ICreatorExtensionTokenURI.sol";
import "../extensions/ICreatorExtensionRoyalties.sol";
import "./ICreatorCore.sol";
/**
* @dev Core creator implementation
*/
abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {
using Strings for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
using AddressUpgradeable for address;
uint256 internal _tokenCount = 0;
// Base approve transfers address location
address internal _approveTransferBase;
// Track registered extensions data
EnumerableSet.AddressSet internal _extensions;
EnumerableSet.AddressSet internal _blacklistedExtensions;
// The baseURI for a given extension
mapping (address => string) private _extensionBaseURI;
mapping (address => bool) private _extensionBaseURIIdentical;
// The prefix for any tokens with a uri configured
mapping (address => string) private _extensionURIPrefix;
// Mapping for individual token URIs
mapping (uint256 => string) internal _tokenURIs;
// Royalty configurations
struct RoyaltyConfig {
address payable receiver;
uint16 bps;
}
mapping (address => RoyaltyConfig[]) internal _extensionRoyalty;
mapping (uint256 => RoyaltyConfig[]) internal _tokenRoyalty;
bytes4 private constant _CREATOR_CORE_V1 = 0x28f10a21;
/**
* External interface identifiers for royalties
*/
/**
* @dev CreatorCore
*
* bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6
*
* => 0xbb3bafd6 = 0xbb3bafd6
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;
/**
* @dev Rarible: RoyaltiesV1
*
* bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb
* bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f
*
* => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;
/**
* @dev Foundation
*
* bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c
*
* => 0xd5a06d4c = 0xd5a06d4c
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c;
/**
* @dev EIP-2981
*
* bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a
*
* => 0x2a55205a = 0x2a55205a
*/
bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(ICreatorCore).interfaceId || interfaceId == _CREATOR_CORE_V1 || super.supportsInterface(interfaceId)
|| interfaceId == _INTERFACE_ID_ROYALTIES_CREATORCORE || interfaceId == _INTERFACE_ID_ROYALTIES_RARIBLE
|| interfaceId == _INTERFACE_ID_ROYALTIES_FOUNDATION || interfaceId == _INTERFACE_ID_ROYALTIES_EIP2981;
}
/**
* @dev Only allows registered extensions to call the specified function
*/
function requireExtension() internal view {
require(_extensions.contains(msg.sender), "Must be registered extension");
}
/**
* @dev Only allows non-blacklisted extensions
*/
function requireNonBlacklist(address extension) internal view {
require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");
}
/**
* @dev See {ICreatorCore-getExtensions}.
*/
function getExtensions() external view override returns (address[] memory extensions) {
extensions = new address[](_extensions.length());
for (uint i; i < _extensions.length();) {
extensions[i] = _extensions.at(i);
unchecked { ++i; }
}
return extensions;
}
/**
* @dev Register an extension
*/
function _registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) internal virtual {
require(extension != address(this) && extension.isContract(), "Invalid");
emit ExtensionRegistered(extension, msg.sender);
_extensionBaseURI[extension] = baseURI;
_extensionBaseURIIdentical[extension] = baseURIIdentical;
_extensions.add(extension);
_setApproveTransferExtension(extension, true);
}
/**
* @dev See {ICreatorCore-setApproveTransferExtension}.
*/
function setApproveTransferExtension(bool enabled) external override {
requireExtension();
_setApproveTransferExtension(msg.sender, enabled);
}
/**
* @dev Set whether or not tokens minted by the extension defers transfer approvals to the extension
*/
function _setApproveTransferExtension(address extension, bool enabled) internal virtual;
/**
* @dev Unregister an extension
*/
function _unregisterExtension(address extension) internal {
emit ExtensionUnregistered(extension, msg.sender);
_extensions.remove(extension);
}
/**
* @dev Blacklist an extension
*/
function _blacklistExtension(address extension) internal {
require(extension != address(0) && extension != address(this), "Cannot blacklist yourself");
if (_extensions.contains(extension)) {
emit ExtensionUnregistered(extension, msg.sender);
_extensions.remove(extension);
}
if (!_blacklistedExtensions.contains(extension)) {
emit ExtensionBlacklisted(extension, msg.sender);
_blacklistedExtensions.add(extension);
}
}
/**
* @dev Set base token uri for an extension
*/
function _setBaseTokenURIExtension(string calldata uri, bool identical) internal {
_extensionBaseURI[msg.sender] = uri;
_extensionBaseURIIdentical[msg.sender] = identical;
}
/**
* @dev Set token uri prefix for an extension
*/
function _setTokenURIPrefixExtension(string calldata prefix) internal {
_extensionURIPrefix[msg.sender] = prefix;
}
/**
* @dev Set token uri for a token of an extension
*/
function _setTokenURIExtension(uint256 tokenId, string calldata uri) internal {
require(_tokenExtension(tokenId) == msg.sender, "Invalid token");
_tokenURIs[tokenId] = uri;
}
/**
* @dev Set base token uri for tokens with no extension
*/
function _setBaseTokenURI(string calldata uri) internal {
_extensionBaseURI[address(0)] = uri;
}
/**
* @dev Set token uri prefix for tokens with no extension
*/
function _setTokenURIPrefix(string calldata prefix) internal {
_extensionURIPrefix[address(0)] = prefix;
}
/**
* @dev Set token uri for a token with no extension
*/
function _setTokenURI(uint256 tokenId, string calldata uri) internal {
require(tokenId > 0 && tokenId <= _tokenCount && _tokenExtension(tokenId) == address(0), "Invalid token");
_tokenURIs[tokenId] = uri;
}
/**
* @dev Retrieve a token's URI
*/
function _tokenURI(uint256 tokenId) internal view returns (string memory) {
require(tokenId > 0 && tokenId <= _tokenCount, "Invalid token");
address extension = _tokenExtension(tokenId);
require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");
if (bytes(_tokenURIs[tokenId]).length != 0) {
if (bytes(_extensionURIPrefix[extension]).length != 0) {
return string(abi.encodePacked(_extensionURIPrefix[extension], _tokenURIs[tokenId]));
}
return _tokenURIs[tokenId];
}
if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionTokenURI).interfaceId)) {
return ICreatorExtensionTokenURI(extension).tokenURI(address(this), tokenId);
}
if (!_extensionBaseURIIdentical[extension]) {
return string(abi.encodePacked(_extensionBaseURI[extension], tokenId.toString()));
} else {
return _extensionBaseURI[extension];
}
}
/**
* Helper to get royalties for a token
*/
function _getRoyalties(uint256 tokenId) view internal returns (address payable[] memory receivers, uint256[] memory bps) {
// Get token level royalties
RoyaltyConfig[] memory royalties = _tokenRoyalty[tokenId];
if (royalties.length == 0) {
// Get extension specific royalties
address extension = _tokenExtension(tokenId);
if (extension != address(0)) {
if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionRoyalties).interfaceId)) {
(receivers, bps) = ICreatorExtensionRoyalties(extension).getRoyalties(address(this), tokenId);
// Extension override exists, just return that
if (receivers.length > 0) return (receivers, bps);
}
royalties = _extensionRoyalty[extension];
}
}
if (royalties.length == 0) {
// Get the default royalty
royalties = _extensionRoyalty[address(0)];
}
if (royalties.length > 0) {
receivers = new address payable[](royalties.length);
bps = new uint256[](royalties.length);
for (uint i; i < royalties.length;) {
receivers[i] = royalties[i].receiver;
bps[i] = royalties[i].bps;
unchecked { ++i; }
}
}
}
/**
* Helper to get royalty receivers for a token
*/
function _getRoyaltyReceivers(uint256 tokenId) view internal returns (address payable[] memory recievers) {
(recievers, ) = _getRoyalties(tokenId);
}
/**
* Helper to get royalty basis points for a token
*/
function _getRoyaltyBPS(uint256 tokenId) view internal returns (uint256[] memory bps) {
(, bps) = _getRoyalties(tokenId);
}
function _getRoyaltyInfo(uint256 tokenId, uint256 value) view internal returns (address receiver, uint256 amount){
(address payable[] memory receivers, uint256[] memory bps) = _getRoyalties(tokenId);
require(receivers.length <= 1, "More than 1 royalty receiver");
if (receivers.length == 0) {
return (address(this), 0);
}
return (receivers[0], bps[0]*value/10000);
}
/**
* Set royalties for a token
*/
function _setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
_checkRoyalties(receivers, basisPoints);
delete _tokenRoyalty[tokenId];
_setRoyalties(receivers, basisPoints, _tokenRoyalty[tokenId]);
emit RoyaltiesUpdated(tokenId, receivers, basisPoints);
}
/**
* Set royalties for all tokens of an extension
*/
function _setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
_checkRoyalties(receivers, basisPoints);
delete _extensionRoyalty[extension];
_setRoyalties(receivers, basisPoints, _extensionRoyalty[extension]);
if (extension == address(0)) {
emit DefaultRoyaltiesUpdated(receivers, basisPoints);
} else {
emit ExtensionRoyaltiesUpdated(extension, receivers, basisPoints);
}
}
/**
* Helper function to check that royalties provided are valid
*/
function _checkRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) private pure {
require(receivers.length == basisPoints.length, "Invalid input");
uint256 totalBasisPoints;
for (uint i; i < basisPoints.length;) {
totalBasisPoints += basisPoints[i];
unchecked { ++i; }
}
require(totalBasisPoints < 10000, "Invalid total royalties");
}
/**
* Helper function to set royalties
*/
function _setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints, RoyaltyConfig[] storage royalties) private {
for (uint i; i < basisPoints.length;) {
royalties.push(
RoyaltyConfig(
{
receiver: receivers[i],
bps: uint16(basisPoints[i])
}
)
);
unchecked { ++i; }
}
}
/**
* @dev Set the base contract's approve transfer contract location
*/
function _setApproveTransferBase(address extension) internal {
_approveTransferBase = extension;
emit ApproveTransferUpdated(extension);
}
/**
* @dev See {ICreatorCore-getApproveTransfer}.
*/
function getApproveTransfer() external view override returns (address) {
return _approveTransferBase;
}
/**
* @dev Get the extension for the given token
*/
function _tokenExtension(uint256 tokenId) internal virtual view returns(address);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IAdminControl.sol";
abstract contract AdminControl is Ownable, IAdminControl, ERC165 {
using EnumerableSet for EnumerableSet.AddressSet;
// Track registered admins
EnumerableSet.AddressSet private _admins;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IAdminControl).interfaceId
|| super.supportsInterface(interfaceId);
}
/**
* @dev Only allows approved admins to call the specified function
*/
modifier adminRequired() {
require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin");
_;
}
/**
* @dev See {IAdminControl-getAdmins}.
*/
function getAdmins() external view override returns (address[] memory admins) {
admins = new address[](_admins.length());
for (uint i = 0; i < _admins.length(); i++) {
admins[i] = _admins.at(i);
}
return admins;
}
/**
* @dev See {IAdminControl-approveAdmin}.
*/
function approveAdmin(address admin) external override onlyOwner {
if (!_admins.contains(admin)) {
emit AdminApproved(admin, msg.sender);
_admins.add(admin);
}
}
/**
* @dev See {IAdminControl-revokeAdmin}.
*/
function revokeAdmin(address admin) external override onlyOwner {
if (_admins.contains(admin)) {
emit AdminRevoked(admin, msg.sender);
_admins.remove(admin);
}
}
/**
* @dev See {IAdminControl-isAdmin}.
*/
function isAdmin(address admin) public override view returns (bool) {
return (owner() == admin || _admins.contains(admin));
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
/**
* Serendipity Lazy Claim interface
*/
interface ISerendipity {
enum StorageProtocol {
INVALID,
NONE,
ARWEAVE,
IPFS
}
error InvalidStorageProtocol();
error InvalidDate();
error InvalidInstance();
error InvalidInput();
error InvalidPayment();
error InvalidSignature();
error InvalidMintCount();
error InvalidVariationIndex();
error InvalidStartingTokenId();
error ClaimAlreadyInitialized();
error ClaimNotInitialized();
error ClaimInactive();
error ClaimSoldOut();
error ContractDeprecated();
error TokenDNE();
error FailedToTransfer();
error TooManyRequested();
error CannotLowerTotalMaxBeyondTotal();
error CannotChangeTokenVariations();
error CannotChangePaymentToken();
error CannotLowertokenVariationsBeyondVariations();
error CannotMintMoreThanReserved();
error CannotMintFromContract();
event SerendipityClaimInitialized(address indexed creatorContract, uint256 indexed instanceId, address initializer);
event SerendipityClaimUpdated(address indexed creatorContract, uint256 indexed instanceId);
event SerendipityMintReserved(
address indexed creatorContract,
uint256 indexed instanceId,
address indexed collector,
uint32 mintCount
);
struct VariationMint {
uint8 variationIndex;
uint32 amount;
address recipient;
}
struct ClaimMint {
address creatorContractAddress;
uint256 instanceId;
VariationMint[] variationMints;
}
struct UserMintDetails {
uint32 reservedCount;
uint32 deliveredCount;
}
/**
* @notice Set the signing address
* @param signer the signer address
*/
function setSigner(address signer) external;
/**
* @notice Withdraw funds
*/
function withdraw(address payable receiver, uint256 amount) external;
/**
* @notice minting request
* @param creatorContractAddress the creator contract address
* @param instanceId the claim instanceId for the creator contract
* @param mintCount the number of claims to mint
*/
function mintReserve(address creatorContractAddress, uint256 instanceId, uint32 mintCount) external payable;
/**
* @notice Deliver NFTs
* initiated after be has handled randomization
* @param mints the mints to deliver with creatorcontractaddress, instanceId and variationMints
*/
function deliverMints(ClaimMint[] calldata mints) external;
/**
* @notice get mints made for a wallet
*
* @param minter the address of the minting address
* @param creatorContractAddress the address of the creator contract for the claim
* @param instanceId the claim instance for the creator contract
* @return userMintdetails the wallet's reservedCount and deliveredCount
*/
function getUserMints(
address minter,
address creatorContractAddress,
uint256 instanceId
) external view returns (UserMintDetails memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/introspection/ERC165Checker.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Library used to query support of an interface declared via {IERC165}.
*
* Note that these functions return the actual result of the query: they do not
* `revert` if an interface is not supported. It is up to the caller to decide
* what to do in these cases.
*/
library ERC165Checker {
// As per the EIP-165 spec, no interface should ever match 0xffffffff
bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
/**
* @dev Returns true if `account` supports the {IERC165} interface.
*/
function supportsERC165(address account) internal view returns (bool) {
// Any contract that implements ERC165 must explicitly indicate support of
// InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
return
supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&
!supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);
}
/**
* @dev Returns true if `account` supports the interface defined by
* `interfaceId`. Support for {IERC165} itself is queried automatically.
*
* See {IERC165-supportsInterface}.
*/
function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
// query support of both ERC165 as per the spec and support of _interfaceId
return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);
}
/**
* @dev Returns a boolean array where each value corresponds to the
* interfaces passed in and whether they're supported or not. This allows
* you to batch check interfaces for a contract where your expectation
* is that some interfaces may not be supported.
*
* See {IERC165-supportsInterface}.
*
* _Available since v3.4._
*/
function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
internal
view
returns (bool[] memory)
{
// an array of booleans corresponding to interfaceIds and whether they're supported or not
bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);
// query support of ERC165 itself
if (supportsERC165(account)) {
// query support of each interface in interfaceIds
for (uint256 i = 0; i < interfaceIds.length; i++) {
interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);
}
}
return interfaceIdsSupported;
}
/**
* @dev Returns true if `account` supports all the interfaces defined in
* `interfaceIds`. Support for {IERC165} itself is queried automatically.
*
* Batch-querying can lead to gas savings by skipping repeated checks for
* {IERC165} support.
*
* See {IERC165-supportsInterface}.
*/
function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
// query support of ERC165 itself
if (!supportsERC165(account)) {
return false;
}
// query support of each interface in interfaceIds
for (uint256 i = 0; i < interfaceIds.length; i++) {
if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {
return false;
}
}
// all interfaces supported
return true;
}
/**
* @notice Query if a contract implements an interface, does not check ERC165 support
* @param account The address of the contract to query for support of an interface
* @param interfaceId The interface identifier, as specified in ERC-165
* @return true if the contract at account indicates support of the interface with
* identifier interfaceId, false otherwise
* @dev Assumes that account contains a contract that supports ERC165, otherwise
* the behavior of this method is undefined. This precondition can be checked
* with {supportsERC165}.
* Interface identification is specified in ERC-165.
*/
function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {
// prepare call
bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);
// perform static call
bool success;
uint256 returnSize;
uint256 returnValue;
assembly {
success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
returnSize := returndatasize()
returnValue := mload(0x00)
}
return success && returnSize >= 0x20 && returnValue > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
/**
* @dev Implement this if you want your extension to have overloadable royalties
*/
interface ICreatorExtensionRoyalties is IERC165 {
/**
* Get the royalties for a given creator/tokenId
*/
function getRoyalties(address creator, uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @author: manifold.xyz
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
/**
* @dev Core creator interface
*/
interface ICreatorCore is IERC165 {
event ExtensionRegistered(address indexed extension, address indexed sender);
event ExtensionUnregistered(address indexed extension, address indexed sender);
event ExtensionBlacklisted(address indexed extension, address indexed sender);
event MintPermissionsUpdated(address indexed extension, address indexed permissions, address indexed sender);
event RoyaltiesUpdated(uint256 indexed tokenId, address payable[] receivers, uint256[] basisPoints);
event DefaultRoyaltiesUpdated(address payable[] receivers, uint256[] basisPoints);
event ApproveTransferUpdated(address extension);
event ExtensionRoyaltiesUpdated(address indexed extension, address payable[] receivers, uint256[] basisPoints);
event ExtensionApproveTransferUpdated(address indexed extension, bool enabled);
/**
* @dev gets address of all extensions
*/
function getExtensions() external view returns (address[] memory);
/**
* @dev add an extension. Can only be called by contract owner or admin.
* extension address must point to a contract implementing ICreatorExtension.
* Returns True if newly added, False if already added.
*/
function registerExtension(address extension, string calldata baseURI) external;
/**
* @dev add an extension. Can only be called by contract owner or admin.
* extension address must point to a contract implementing ICreatorExtension.
* Returns True if newly added, False if already added.
*/
function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external;
/**
* @dev add an extension. Can only be called by contract owner or admin.
* Returns True if removed, False if already removed.
*/
function unregisterExtension(address extension) external;
/**
* @dev blacklist an extension. Can only be called by contract owner or admin.
* This function will destroy all ability to reference the metadata of any tokens created
* by the specified extension. It will also unregister the extension if needed.
* Returns True if removed, False if already removed.
*/
function blacklistExtension(address extension) external;
/**
* @dev set the baseTokenURI of an extension. Can only be called by extension.
*/
function setBaseTokenURIExtension(string calldata uri) external;
/**
* @dev set the baseTokenURI of an extension. Can only be called by extension.
* For tokens with no uri configured, tokenURI will return "uri+tokenId"
*/
function setBaseTokenURIExtension(string calldata uri, bool identical) external;
/**
* @dev set the common prefix of an extension. Can only be called by extension.
* If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI"
* Useful if you want to use ipfs/arweave
*/
function setTokenURIPrefixExtension(string calldata prefix) external;
/**
* @dev set the tokenURI of a token extension. Can only be called by extension that minted token.
*/
function setTokenURIExtension(uint256 tokenId, string calldata uri) external;
/**
* @dev set the tokenURI of a token extension for multiple tokens. Can only be called by extension that minted token.
*/
function setTokenURIExtension(uint256[] memory tokenId, string[] calldata uri) external;
/**
* @dev set the baseTokenURI for tokens with no extension. Can only be called by owner/admin.
* For tokens with no uri configured, tokenURI will return "uri+tokenId"
*/
function setBaseTokenURI(string calldata uri) external;
/**
* @dev set the common prefix for tokens with no extension. Can only be called by owner/admin.
* If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI"
* Useful if you want to use ipfs/arweave
*/
function setTokenURIPrefix(string calldata prefix) external;
/**
* @dev set the tokenURI of a token with no extension. Can only be called by owner/admin.
*/
function setTokenURI(uint256 tokenId, string calldata uri) external;
/**
* @dev set the tokenURI of multiple tokens with no extension. Can only be called by owner/admin.
*/
function setTokenURI(uint256[] memory tokenIds, string[] calldata uris) external;
/**
* @dev set a permissions contract for an extension. Used to control minting.
*/
function setMintPermissions(address extension, address permissions) external;
/**
* @dev Configure so transfers of tokens created by the caller (must be extension) gets approval
* from the extension before transferring
*/
function setApproveTransferExtension(bool enabled) external;
/**
* @dev get the extension of a given token
*/
function tokenExtension(uint256 tokenId) external view returns (address);
/**
* @dev Set default royalties
*/
function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external;
/**
* @dev Set royalties of a token
*/
function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
/**
* @dev Set royalties of an extension
*/
function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
/**
* @dev Get royalites of a token. Returns list of receivers and basisPoints
*/
function getRoyalties(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
// Royalty support for various other standards
function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);
function getFeeBps(uint256 tokenId) external view returns (uint[] memory);
function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);
/**
* @dev Set the default approve transfer contract location.
*/
function setApproveTransfer(address extension) external;
/**
* @dev Get the default approve transfer contract location.
*/
function getApproveTransfer() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions 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;
/// @author: manifold.xyz
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
/**
* @dev Interface for admin control
*/
interface IAdminControl is IERC165 {
event AdminApproved(address indexed account, address indexed sender);
event AdminRevoked(address indexed account, address indexed sender);
/**
* @dev gets address of all admins
*/
function getAdmins() external view returns (address[] memory);
/**
* @dev add an admin. Can only be called by contract owner.
*/
function approveAdmin(address admin) external;
/**
* @dev remove an admin. Can only be called by contract owner.
*/
function revokeAdmin(address admin) external;
/**
* @dev checks whether or not given address is an admin
* Returns True if they are
*/
function isAdmin(address admin) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}{
"remappings": [
"create2-scripts/=lib/create2-helpers/script/",
"create2-helpers/=lib/create2-helpers/src/",
"forge-std/=lib/forge-std/src/",
"@ensdomains/=node_modules/@ensdomains/",
"@manifoldxyz/=node_modules/@manifoldxyz/",
"@openzeppelin/=node_modules/@openzeppelin/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/operator-filter-registry/lib/openzeppelin-contracts/lib/erc4626-tests/",
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
"hardhat/=node_modules/hardhat/",
"murky/=lib/murky/src/",
"openzeppelin-contracts-upgradeable/=lib/operator-filter-registry/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/murky/lib/openzeppelin-contracts/",
"operator-filter-registry/=node_modules/operator-filter-registry/",
"truffle/=node_modules/truffle/"
],
"optimizer": {
"enabled": true,
"runs": 1000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "london",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CannotChangePaymentToken","type":"error"},{"inputs":[],"name":"CannotChangeTokenVariations","type":"error"},{"inputs":[],"name":"CannotLowerTotalMaxBeyondTotal","type":"error"},{"inputs":[],"name":"CannotLowertokenVariationsBeyondVariations","type":"error"},{"inputs":[],"name":"CannotMintFromContract","type":"error"},{"inputs":[],"name":"CannotMintMoreThanReserved","type":"error"},{"inputs":[],"name":"ClaimAlreadyInitialized","type":"error"},{"inputs":[],"name":"ClaimInactive","type":"error"},{"inputs":[],"name":"ClaimNotInitialized","type":"error"},{"inputs":[],"name":"ClaimSoldOut","type":"error"},{"inputs":[],"name":"ContractDeprecated","type":"error"},{"inputs":[],"name":"FailedToTransfer","type":"error"},{"inputs":[],"name":"InvalidDate","type":"error"},{"inputs":[],"name":"InvalidInput","type":"error"},{"inputs":[],"name":"InvalidInstance","type":"error"},{"inputs":[],"name":"InvalidMintCount","type":"error"},{"inputs":[],"name":"InvalidPayment","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidStartingTokenId","type":"error"},{"inputs":[],"name":"InvalidStorageProtocol","type":"error"},{"inputs":[],"name":"InvalidVariationIndex","type":"error"},{"inputs":[],"name":"TokenDNE","type":"error"},{"inputs":[],"name":"TooManyRequested","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"instanceId","type":"uint256"},{"indexed":false,"internalType":"address","name":"initializer","type":"address"}],"name":"SerendipityClaimInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"instanceId","type":"uint256"}],"name":"SerendipityClaimUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"creatorContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"instanceId","type":"uint256"},{"indexed":true,"internalType":"address","name":"collector","type":"address"},{"indexed":false,"internalType":"uint32","name":"mintCount","type":"uint32"}],"name":"SerendipityMintReserved","type":"event"},{"inputs":[],"name":"MINT_FEE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"approveAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"},{"components":[{"internalType":"uint8","name":"variationIndex","type":"uint8"},{"internalType":"uint32","name":"amount","type":"uint32"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct ISerendipity.VariationMint[]","name":"variationMints","type":"tuple[]"}],"internalType":"struct ISerendipity.ClaimMint[]","name":"mints","type":"tuple[]"}],"name":"deliverMints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_deprecated","type":"bool"}],"name":"deprecate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deprecated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAdmins","outputs":[{"internalType":"address[]","name":"admins","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"}],"name":"getClaim","outputs":[{"components":[{"internalType":"enum ISerendipity.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"uint32","name":"total","type":"uint32"},{"internalType":"uint32","name":"totalMax","type":"uint32"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"uint80","name":"startingTokenId","type":"uint80"},{"internalType":"uint8","name":"tokenVariations","type":"uint8"},{"internalType":"string","name":"location","type":"string"},{"internalType":"address payable","name":"paymentReceiver","type":"address"},{"internalType":"uint96","name":"cost","type":"uint96"},{"internalType":"address","name":"erc20","type":"address"}],"internalType":"struct IERC1155Serendipity.Claim","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getClaimForToken","outputs":[{"internalType":"uint256","name":"instanceId","type":"uint256"},{"components":[{"internalType":"enum ISerendipity.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"uint32","name":"total","type":"uint32"},{"internalType":"uint32","name":"totalMax","type":"uint32"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"uint80","name":"startingTokenId","type":"uint80"},{"internalType":"uint8","name":"tokenVariations","type":"uint8"},{"internalType":"string","name":"location","type":"string"},{"internalType":"address payable","name":"paymentReceiver","type":"address"},{"internalType":"uint96","name":"cost","type":"uint96"},{"internalType":"address","name":"erc20","type":"address"}],"internalType":"struct IERC1155Serendipity.Claim","name":"claim","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"}],"name":"getUserMints","outputs":[{"components":[{"internalType":"uint32","name":"reservedCount","type":"uint32"},{"internalType":"uint32","name":"deliveredCount","type":"uint32"}],"internalType":"struct ISerendipity.UserMintDetails","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"},{"components":[{"internalType":"enum ISerendipity.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"uint32","name":"totalMax","type":"uint32"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"uint8","name":"tokenVariations","type":"uint8"},{"internalType":"string","name":"location","type":"string"},{"internalType":"address payable","name":"paymentReceiver","type":"address"},{"internalType":"uint96","name":"cost","type":"uint96"},{"internalType":"address","name":"erc20","type":"address"}],"internalType":"struct IERC1155Serendipity.ClaimParameters","name":"claimParameters","type":"tuple"}],"name":"initializeClaim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"},{"internalType":"uint32","name":"mintCount","type":"uint32"}],"name":"mintReserve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"revokeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"},{"components":[{"internalType":"enum ISerendipity.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"address payable","name":"paymentReceiver","type":"address"},{"internalType":"uint32","name":"totalMax","type":"uint32"},{"internalType":"uint48","name":"startDate","type":"uint48"},{"internalType":"uint48","name":"endDate","type":"uint48"},{"internalType":"uint96","name":"cost","type":"uint96"},{"internalType":"string","name":"location","type":"string"}],"internalType":"struct IERC1155Serendipity.UpdateClaimParameters","name":"updateClaimParameters","type":"tuple"}],"name":"updateClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"},{"internalType":"enum ISerendipity.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"string","name":"location","type":"string"}],"name":"updateTokenURIParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b50604051620040bd380380620040bd8339810160408190526200003491620000a3565b80620000403362000053565b6200004b8162000053565b5050620000d5565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000b657600080fd5b81516001600160a01b0381168114620000ce57600080fd5b9392505050565b613fd880620000e56000396000f3fe6080604052600436106101755760003560e01c80636d73e669116100cb5780639251cff41161007f578063f2fde38b11610059578063f2fde38b1461042c578063f3fef3a31461044c578063fbf522a31461046c57600080fd5b80639251cff4146103b6578063d7bf81a3146103d6578063e9dc6375146103ff57600080fd5b8063715018a6116100b0578063715018a61461034b578063895696f2146103605780638da5cb5b1461038e57600080fd5b80636d73e6691461030b5780636e12056a1461032b57600080fd5b806312c616121161012d57806331ae450b1161010757806331ae450b146102b657806333032dac146102d85780636c19e783146102eb57600080fd5b806312c616121461023257806324d7806c146102765780632d3456701461029657600080fd5b806308e845191161015e57806308e84519146101d15780630e136b19146101e45780630f79ab391461020557600080fd5b806301e5907e1461017a57806301ffc9a71461019c575b600080fd5b34801561018657600080fd5b5061019a61019536600461333a565b61048c565b005b3480156101a857600080fd5b506101bc6101b736600461342b565b610b3c565b60405190151581526020015b60405180910390f35b61019a6101df366004613455565b610c41565b3480156101f057600080fd5b506003546101bc90600160a01b900460ff1681565b34801561021157600080fd5b506102256102203660046134b6565b6114f6565b6040516101c89190613678565b34801561023e57600080fd5b5061025261024d36600461368b565b6116d6565b60408051825163ffffffff90811682526020938401511692810192909252016101c8565b34801561028257600080fd5b506101bc6102913660046136cc565b61174d565b3480156102a257600080fd5b5061019a6102b13660046136cc565b611786565b3480156102c257600080fd5b506102cb6117e4565b6040516101c8919061372d565b61019a6102e6366004613740565b611893565b3480156102f757600080fd5b5061019a6103063660046136cc565b611cbc565b34801561031757600080fd5b5061019a6103263660046136cc565b611d71565b34801561033757600080fd5b5061019a61034636600461377e565b611dc9565b34801561035757600080fd5b5061019a611f48565b34801561036c57600080fd5b5061038061037b3660046134b6565b611f5c565b6040516101c892919061381b565b34801561039a57600080fd5b506000546040516001600160a01b0390911681526020016101c8565b3480156103c257600080fd5b5061019a6103d1366004613842565b61215d565b3480156103e257600080fd5b506103f16601c6bf5263400081565b6040519081526020016101c8565b34801561040b57600080fd5b5061041f61041a3660046134b6565b61221c565b6040516101c8919061385f565b34801561043857600080fd5b5061019a6104473660046136cc565b61251a565b34801561045857600080fd5b5061019a6104673660046134b6565b6125a7565b34801561047857600080fd5b5061019a610487366004613872565b6126a6565b604051630935e01b60e21b8152336004820152839081906001600160a01b038216906324d7806c90602401602060405180830381865afa1580156104d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f891906138e7565b61055d5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084015b60405180910390fd5b600354600160a01b900460ff16156105885760405163d17e0deb60e01b815260040160405180910390fd5b60006105948686612ce2565b6040805161016081019091528154909190829060ff1660038111156105bb576105bb6134e2565b60038111156105cc576105cc6134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e09092019161064f90613904565b80601f016020809104026020016040519081016040528092919081815260200182805461067b90613904565b80156106c85780601f1061069d576101008083540402835291602001916106c8565b820191906000526020600020905b8154815290600101906020018083116106ab57829003601f168201915b505050918352505060028201546001600160a01b038082166020840152600160a01b9091046001600160601b03166040830152600390920154909116606090910152905084158061071f575066ffffffffffffff85115b1561073d5760405163603b655960e01b815260040160405180910390fd5b608084015165ffffffffffff16158015906107705750836080015165ffffffffffff16846060015165ffffffffffff1610155b1561078e576040516381bf7f6760e01b815260040160405180910390fd5b604084015163ffffffff16158015906107ba5750806020015163ffffffff16846040015163ffffffff16105b156107f1576040517fc7fb59c000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b63ffffffff846040015163ffffffff1611156108205760405163b4fa3fb360e01b815260040160405180910390fd5b600084516003811115610835576108356134e2565b036108535760405163cc14845760e01b815260040160405180910390fd5b6001600160601b038460a001516001600160601b031611156108885760405163b4fa3fb360e01b815260040160405180910390fd5b604051806101600160405280856000015160038111156108aa576108aa6134e2565b815260208381015163ffffffff908116828401526040888101519091168184015260608089015165ffffffffffff908116918501919091526080808a01519091169084015260a08086015169ffffffffffffffffffff168185015260c08087015160ff168186015289015160e0850152888301516001600160a01b03908116610100860152908901516001600160601b03166101208501526101408087015182169401939093529189166000908152600582528281208982529091522081518154829060ff19166001836003811115610985576109856134e2565b02179055506020820151815460408401516060850151608086015160a087015160c088015168ffffffffffffffff001990951661010063ffffffff9788160268ffffffff00000000001916176501000000000096909416959095029290921774ffffffffffffffffffffffff0000000000000000001916600160481b65ffffffffffff9283160274ffffffffffff000000000000000000000000000000191617600160781b91909216021774ffffffffffffffffffffffffffffffffffffffffff16600160a81b69ffffffffffffffffffff909316929092027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1691909117600160f81b60ff9092169190910217815560e08201516001820190610aa8908261398c565b506101008201516101208301516001600160601b0316600160a01b026001600160a01b03918216176002830155610140909201516003909101805491831673ffffffffffffffffffffffffffffffffffffffff199290921691909117905560405186918816907fcd514d5a4a2a03dfd7e4ea6e5ead7f67a401bef8aa4401e0d0c5143d3c15c56f90600090a3505050505050565b60006001600160e01b031982167fe130edc6000000000000000000000000000000000000000000000000000000001480610b9f57506001600160e01b031982167f45d70d3d00000000000000000000000000000000000000000000000000000000145b80610bd357506001600160e01b031982167fe9dc637500000000000000000000000000000000000000000000000000000000145b80610c0757506001600160e01b031982167f553e757e00000000000000000000000000000000000000000000000000000000145b80610c3b57506001600160e01b031982167f01ffc9a700000000000000000000000000000000000000000000000000000000145b92915050565b604051630935e01b60e21b8152336004820152839081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015610c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cad91906138e7565b610d0d5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610554565b600354600160a01b900460ff1615610d385760405163d17e0deb60e01b815260040160405180910390fd5b831580610d4b575066ffffffffffffff84115b15610d695760405163603b655960e01b815260040160405180910390fd5b6001600160a01b038516600090815260056020908152604080832087845290915281205460ff166003811115610da157610da16134e2565b14610dd8576040517f8b6e785900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610de76020850185613a4c565b6003811115610df857610df86134e2565b03610e165760405163cc14845760e01b815260040160405180910390fd5b610e266080840160608501613a67565b65ffffffffffff1615801590610e6a5750610e476080840160608501613a67565b65ffffffffffff16610e5f6060850160408601613a67565b65ffffffffffff1610155b15610e88576040516381bf7f6760e01b815260040160405180910390fd5b63ffffffff610e9d6040850160208601613a82565b63ffffffff161115610ec25760405163b4fa3fb360e01b815260040160405180910390fd5b60ff610ed460a0850160808601613a9d565b60ff161115610ef65760405163b4fa3fb360e01b815260040160405180910390fd5b6001600160601b03610f0f610100850160e08601613ac0565b6001600160601b03161115610f375760405163b4fa3fb360e01b815260040160405180910390fd5b604080516001808252818301909252600091602080830190803683370190505090503381600081518110610f6d57610f6d613adb565b6001600160a01b03909216602092830291909101909101526000610f9760a0860160808701613a9d565b60ff1667ffffffffffffffff811115610fb257610fb26131fa565b604051908082528060200260200182016040528015610fdb578160200160208202803683370190505b5090506000610ff060a0870160808801613a9d565b60ff1667ffffffffffffffff81111561100b5761100b6131fa565b60405190808252806020026020018201604052801561103e57816020015b60608152602001906001900390816110295790505b5090506000886001600160a01b0316638c6e84728585856040518463ffffffff1660e01b815260040161107393929190613b21565b6000604051808303816000875af1158015611092573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110ba9190810190613ba8565b905069ffffffffffffffffffff816000815181106110da576110da613adb565b6020026020010151111561110157604051631763a91f60e21b815260040160405180910390fd5b6040805161016081019091528061111b60208a018a613a4c565b600381111561112c5761112c6134e2565b8152602001600063ffffffff1681526020018860200160208101906111519190613a82565b63ffffffff16815260200161116c60608a0160408b01613a67565b65ffffffffffff16815260200161118960808a0160608b01613a67565b65ffffffffffff168152602001826000815181106111a9576111a9613adb565b602002602001015169ffffffffffffffffffff1681526020018860800160208101906111d59190613a9d565b60ff1681526020016111ea60a08a018a613c4e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161123460e08a0160c08b016136cc565b6001600160a01b031681526020016112536101008a0160e08b01613ac0565b6001600160601b031681526020016112736101208a016101008b016136cc565b6001600160a01b039081169091528a1660009081526005602090815260408083208c8452909152902081518154829060ff191660018360038111156112ba576112ba6134e2565b02179055506020820151815460408401516060850151608086015160a087015160c088015168ffffffffffffffff001990951661010063ffffffff9788160268ffffffff00000000001916176501000000000096909416959095029290921774ffffffffffffffffffffffff0000000000000000001916600160481b65ffffffffffff9283160274ffffffffffff000000000000000000000000000000191617600160781b91909216021774ffffffffffffffffffffffffffffffffffffffffff16600160a81b69ffffffffffffffffffff909316929092027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1691909117600160f81b60ff9092169190910217815560e082015160018201906113dd908261398c565b506101008201516101208301516001600160601b0316600160a01b026001600160a01b0391821617600283015561014090920151600390910180549190921673ffffffffffffffffffffffffffffffffffffffff199190911617905560005b61144c60a0890160808a01613a9d565b60ff168110156114aa576001600160a01b038a16600090815260066020526040812083518b929085908590811061148557611485613adb565b602002602001015181526020019081526020016000208190555080600101905061143c565b5060405133815288906001600160a01b038b16907fa86c2cb52a6fa7971af0717068d16ef16902ea3832013454c5f224cff78b7c799060200160405180910390a3505050505050505050565b604080516101608101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e0820152610100810182905261012081018290526101408101919091526115588383612ce2565b6040805161016081019091528154909190829060ff16600381111561157f5761157f6134e2565b6003811115611590576115906134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e09092019161161390613904565b80601f016020809104026020016040519081016040528092919081815260200182805461163f90613904565b801561168c5780601f106116615761010080835404028352916020019161168c565b820191906000526020600020905b81548152906001019060200180831161166f57829003601f168201915b505050918352505060028201546001600160a01b038082166020840152600160a01b9091046001600160601b03166040830152600390920154909116606090910152905092915050565b604080518082018252600080825260208083018290528351808501855282815281018290526001600160a01b038087168352600482528483208684528252848320908816835281529083902083518085019094525463ffffffff80821685526401000000009091041690830152905b949350505050565b6000816001600160a01b031661176b6000546001600160a01b031690565b6001600160a01b03161480610c3b5750610c3b600183612d53565b61178e612d78565b611799600182612d53565b156117e15760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a36117df600182612dd2565b505b50565b60606117f06001612de7565b67ffffffffffffffff811115611808576118086131fa565b604051908082528060200260200182016040528015611831578160200160208202803683370190505b50905060005b6118416001612de7565b81101561188f57611853600182612df1565b82828151811061186557611865613adb565b6001600160a01b03909216602092830291909101909101528061188781613cb2565b915050611837565b5090565b333b156118cc576040517f2dd5679600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006118d88484612ce2565b905063ffffffff821615806118f7575063ffffffff8263ffffffff1610155b1561192e576040517fe59e82a200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805442600160481b90910465ffffffffffff16118061197757508054600160781b900465ffffffffffff16158015906119775750805442600160781b90910465ffffffffffff16105b156119ae576040517fc84651bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805465010000000000900463ffffffff16158015906119e457508054610100810463ffffffff9081166501000000000090920416145b15611a1b576040517fad6d3b4f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805463fffffffe1961010090910463ffffffff1601611a4d57604051638d83cdd760e01b815260040160405180910390fd5b600281015463ffffffff831690611a7c906601c6bf5263400090600160a01b90046001600160601b0316613ccb565b611a869190613cde565b3414611abe576040517f3c6b4b2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8054829065010000000000900463ffffffff1615611b0e578154611b0b9063ffffffff80861691611b0091610100820481169165010000000000900416613cf5565b63ffffffff16612dfd565b90505b815481908390600190611b2d908490610100900463ffffffff16613d12565b82546101009290920a63ffffffff8181021990931691831602179091556001600160a01b03871660009081526004602090815260408083208984528252808320338452909152812080548594509092611b8891859116613d12565b825463ffffffff9182166101009390930a92830291909202199091161790555060028201546001600160601b03600160a01b9091041615611c06576002820154611c06906001600160a01b03811690611bf89063ffffffff851690600160a01b90046001600160601b0316613d2f565b6001600160601b0316612e13565b8263ffffffff168163ffffffff1614611c6d57600282015460009063ffffffff831690611c4b906601c6bf5263400090600160a01b90046001600160601b0316613ccb565b611c559190613cde565b611c5f9034613d5a565b9050611c6b3382612e13565b505b60405163ffffffff82168152339085906001600160a01b038816907f8f86c88b5cf44f69cf04133c647fc1c3a88bffe5d6797f5f178a1432ab75daf59060200160405180910390a45050505050565b33611ccf6000546001600160a01b031690565b6001600160a01b03161480611cea5750611cea600133612d53565b611d425760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610554565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b611d79612d78565b611d84600182612d53565b6117e15760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a36117df600182612e3a565b604051630935e01b60e21b8152336004820152859081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015611e11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3591906138e7565b611e955760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610554565b6000611ea18888612ce2565b90506000866003811115611eb757611eb76134e2565b03611ed55760405163cc14845760e01b815260040160405180910390fd5b80548690829060ff19166001836003811115611ef357611ef36134e2565b021790555060018101611f07858783613d6d565b5060405187906001600160a01b038a16907fcd514d5a4a2a03dfd7e4ea6e5ead7f67a401bef8aa4401e0d0c5143d3c15c56f90600090a35050505050505050565b611f50612d78565b611f5a6000612e4f565b565b60408051610160810182526000808252602080830182905282840182905260608084018390526080840183905260a0840183905260c0840183905260e08401526101008301829052610120830182905261014083018290526001600160a01b0386168252600681528382208583529052919091205490611fdc8483612ce2565b6040805161016081019091528154909190829060ff166003811115612003576120036134e2565b6003811115612014576120146134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e09092019161209790613904565b80601f01602080910402602001604051908101604052809291908181526020018280546120c390613904565b80156121105780601f106120e557610100808354040283529160200191612110565b820191906000526020600020905b8154815290600101906020018083116120f357829003601f168201915b505050918352505060028201546001600160a01b038082166020840152600160a01b9091046001600160601b03166040830152600390920154909116606090910152919491935090915050565b336121706000546001600160a01b031690565b6001600160a01b0316148061218b575061218b600133612d53565b6121e35760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610554565b60038054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6001600160a01b038216600090815260066020908152604080832084845290915281205460609181900361227c576040517f2c17b50900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006122888583612ce2565b6040805161016081019091528154909190829060ff1660038111156122af576122af6134e2565b60038111156122c0576122c06134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e09092019161234390613904565b80601f016020809104026020016040519081016040528092919081815260200182805461236f90613904565b80156123bc5780601f10612391576101008083540402835291602001916123bc565b820191906000526020600020905b81548152906001019060200180831161239f57829003601f168201915b50505091835250506002828101546001600160a01b03808216602080860191909152600160a01b9092046001600160601b0316604080860191909152600390950154166060909301929092528251918201909252600081529192508251600381111561242a5761242a6134e2565b03612469575060408051808201909152601481527f68747470733a2f2f617277656176652e6e65742f00000000000000000000000060208201526124b9565b60038251600381111561247e5761247e6134e2565b036124b9575060408051808201909152600781527f697066733a2f2f0000000000000000000000000000000000000000000000000060208201525b808260e001516124ee8460a0015169ffffffffffffffffffff16886124de9190613d5a565b6124e9906001613ccb565b612eac565b60405160200161250093929190613e2e565b604051602081830303815290604052935050505092915050565b612522612d78565b6001600160a01b03811661259e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610554565b6117e181612e4f565b336125ba6000546001600160a01b031690565b6001600160a01b031614806125d557506125d5600133612d53565b61262d5760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610554565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461267a576040519150601f19603f3d011682016040523d82523d6000602084013e61267f565b606091505b50509050806126a15760405163f6a9b88f60e01b815260040160405180910390fd5b505050565b6126ae612f4c565b60005b818110156126a157368383838181106126cc576126cc613adb565b90506020028101906126de9190613e9a565b905060006126fc6126f260208401846136cc565b8360200135612ce2565b6040805161016081019091528154909190829060ff166003811115612723576127236134e2565b6003811115612734576127346134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e0909201916127b790613904565b80601f01602080910402602001604051908101604052809291908181526020018280546127e390613904565b80156128305780601f1061280557610100808354040283529160200191612830565b820191906000526020600020905b81548152906001019060200180831161281357829003601f168201915b505050918352505060028201546001600160a01b038082166020840152600160a01b9091046001600160601b03166040808401919091526003909301541660609091015290915060009061288690840184613eba565b905067ffffffffffffffff8111156128a0576128a06131fa565b6040519080825280602002602001820160405280156128c9578160200160208202803683370190505b50905060006128db6040850185613eba565b905067ffffffffffffffff8111156128f5576128f56131fa565b60405190808252806020026020018201604052801561291e578160200160208202803683370190505b50905060006129306040860186613eba565b905067ffffffffffffffff81111561294a5761294a6131fa565b604051908082528060200260200182016040528015612973578160200160208202803683370190505b50905060005b6129866040870187613eba565b9050811015612c62573661299d6040880188613eba565b838181106129ad576129ad613adb565b60600291909101915060ff90506129c76020830183613a9d565b60ff1611156129e95760405163124e3e7160e01b815260040160405180910390fd5b60006129f86020830183613a9d565b90508660c0015160ff168160ff161180612a15575060018160ff16105b15612a335760405163124e3e7160e01b815260040160405180910390fd5b6000612a4560608401604085016136cc565b905063ffffffff612a5c6040850160208601613a82565b63ffffffff161115612a8157604051638d83cdd760e01b815260040160405180910390fd5b6000612a936040850160208601613a82565b90506000600481612aa760208e018e6136cc565b6001600160a01b039081168252602080830193909352604091820160009081208f85013582528452828120918716815292529020805490915063ffffffff80821691612afd918591640100000000900416613d12565b63ffffffff161115612b3b576040517f40a375cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b69ffffffffffffffffffff8a60a0015169ffffffffffffffffffff161115612b7657604051631763a91f60e21b815260040160405180910390fd5b60018460ff168b60a00151612b8b9190613f03565b612b959190613f26565b69ffffffffffffffffffff16878781518110612bb357612bb3613adb565b6020026020010181815250508163ffffffff16888781518110612bd857612bd8613adb565b60200260200101818152505082898781518110612bf757612bf7613adb565b6001600160a01b0390921660209283029190910190910152805482908290600490612c3290849063ffffffff64010000000090910416613d12565b92506101000a81548163ffffffff021916908363ffffffff16021790555085806001019650505050505050612979565b50612c7060208601866136cc565b6001600160a01b031663e6c884dc8483856040518463ffffffff1660e01b8152600401612c9f93929190613f49565b600060405180830381600087803b158015612cb957600080fd5b505af1158015612ccd573d6000803e3d6000fd5b5050600190970196506126b195505050505050565b6001600160a01b0382166000908152600560209081526040808320848452909152812090815460ff166003811115612d1c57612d1c6134e2565b03610c3b576040517f7f07ad4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b6000546001600160a01b03163314611f5a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610554565b6000612d71836001600160a01b038416612f90565b6000610c3b825490565b6000612d71838361308a565b6000818310612e0c5781612d71565b5090919050565b6001600160a01b03821661262d5760405163f6a9b88f60e01b815260040160405180910390fd5b6000612d71836001600160a01b0384166130b4565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60606000612eb983613103565b600101905060008167ffffffffffffffff811115612ed957612ed96131fa565b6040519080825280601f01601f191660200182016040528015612f03576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084612f0d57509392505050565b6003546001600160a01b03163314611f5a576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526001830160205260408120548015613079576000612fb4600183613d5a565b8554909150600090612fc890600190613d5a565b905081811461302d576000866000018281548110612fe857612fe8613adb565b906000526020600020015490508087600001848154811061300b5761300b613adb565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061303e5761303e613f8c565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610c3b565b6000915050610c3b565b5092915050565b60008260000182815481106130a1576130a1613adb565b9060005260206000200154905092915050565b60008181526001830160205260408120546130fb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c3b565b506000610c3b565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061314c577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310613178576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061319657662386f26fc10000830492506010015b6305f5e10083106131ae576305f5e100830492506008015b61271083106131c257612710830492506004015b606483106131d4576064830492506002015b600a8310610c3b5760010192915050565b6001600160a01b03811681146117e157600080fd5b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff81118282101715613233576132336131fa565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715613262576132626131fa565b604052919050565b80356004811061327957600080fd5b919050565b8035613279816131e5565b803563ffffffff8116811461327957600080fd5b803565ffffffffffff8116811461327957600080fd5b80356001600160601b038116811461327957600080fd5b600082601f8301126132db57600080fd5b813567ffffffffffffffff8111156132f5576132f56131fa565b613308601f8201601f1916602001613239565b81815284602083860101111561331d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561334f57600080fd5b833561335a816131e5565b925060208401359150604084013567ffffffffffffffff8082111561337e57600080fd5b9085019060e0828803121561339257600080fd5b61339a613210565b6133a38361326a565b81526133b16020840161327e565b60208201526133c260408401613289565b60408201526133d36060840161329d565b60608201526133e46080840161329d565b60808201526133f560a084016132b3565b60a082015260c08301358281111561340c57600080fd5b613418898286016132ca565b60c0830152508093505050509250925092565b60006020828403121561343d57600080fd5b81356001600160e01b031981168114612d7157600080fd5b60008060006060848603121561346a57600080fd5b8335613475816131e5565b925060208401359150604084013567ffffffffffffffff81111561349857600080fd5b840161012081870312156134ab57600080fd5b809150509250925092565b600080604083850312156134c957600080fd5b82356134d4816131e5565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6004811061351657634e487b7160e01b600052602160045260246000fd5b9052565b60005b8381101561353557818101518382015260200161351d565b50506000910152565b6000815180845261355681602086016020860161351a565b601f01601f19169290920160200192915050565b600061016061357a8484516134f8565b6020830151613591602086018263ffffffff169052565b5060408301516135a9604086018263ffffffff169052565b5060608301516135c3606086018265ffffffffffff169052565b5060808301516135dd608086018265ffffffffffff169052565b5060a08301516135fb60a086018269ffffffffffffffffffff169052565b5060c083015161361060c086018260ff169052565b5060e08301518160e08601526136288286018261353e565b91505061010080840151613646828701826001600160a01b03169052565b5050610120838101516001600160601b031690850152610140928301516001600160a01b031692909301919091525090565b602081526000612d71602083018461356a565b6000806000606084860312156136a057600080fd5b83356136ab816131e5565b925060208401356136bb816131e5565b929592945050506040919091013590565b6000602082840312156136de57600080fd5b8135612d71816131e5565b600081518084526020808501945080840160005b838110156137225781516001600160a01b0316875295820195908201906001016136fd565b509495945050505050565b602081526000612d7160208301846136e9565b60008060006060848603121561375557600080fd5b8335613760816131e5565b92506020840135915061377560408501613289565b90509250925092565b60008060008060006080868803121561379657600080fd5b85356137a1816131e5565b9450602086013593506137b66040870161326a565b9250606086013567ffffffffffffffff808211156137d357600080fd5b818801915088601f8301126137e757600080fd5b8135818111156137f657600080fd5b89602082850101111561380857600080fd5b9699959850939650602001949392505050565b828152604060208201526000611745604083018461356a565b80151581146117e157600080fd5b60006020828403121561385457600080fd5b8135612d7181613834565b602081526000612d71602083018461353e565b6000806020838503121561388557600080fd5b823567ffffffffffffffff8082111561389d57600080fd5b818501915085601f8301126138b157600080fd5b8135818111156138c057600080fd5b8660208260051b85010111156138d557600080fd5b60209290920196919550909350505050565b6000602082840312156138f957600080fd5b8151612d7181613834565b600181811c9082168061391857607f821691505b60208210810361393857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156126a157600081815260208120601f850160051c810160208610156139655750805b601f850160051c820191505b8181101561398457828155600101613971565b505050505050565b815167ffffffffffffffff8111156139a6576139a66131fa565b6139ba816139b48454613904565b8461393e565b602080601f8311600181146139ef57600084156139d75750858301515b600019600386901b1c1916600185901b178555613984565b600085815260208120601f198616915b82811015613a1e578886015182559484019460019091019084016139ff565b5085821015613a3c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215613a5e57600080fd5b612d718261326a565b600060208284031215613a7957600080fd5b612d718261329d565b600060208284031215613a9457600080fd5b612d7182613289565b600060208284031215613aaf57600080fd5b813560ff81168114612d7157600080fd5b600060208284031215613ad257600080fd5b612d71826132b3565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561372257815187529582019590820190600101613b05565b606081526000613b3460608301866136e9565b602083820381850152613b478287613af1565b915083820360408501528185518084528284019150828160051b85010183880160005b83811015613b9857601f19878403018552613b8683835161353e565b94860194925090850190600101613b6a565b50909a9950505050505050505050565b60006020808385031215613bbb57600080fd5b825167ffffffffffffffff80821115613bd357600080fd5b818501915085601f830112613be757600080fd5b815181811115613bf957613bf96131fa565b8060051b9150613c0a848301613239565b8181529183018401918481019088841115613c2457600080fd5b938501935b83851015613c4257845182529385019390850190613c29565b98975050505050505050565b6000808335601e19843603018112613c6557600080fd5b83018035915067ffffffffffffffff821115613c8057600080fd5b602001915036819003821315613c9557600080fd5b9250929050565b634e487b7160e01b600052601160045260246000fd5b600060018201613cc457613cc4613c9c565b5060010190565b80820180821115610c3b57610c3b613c9c565b8082028115828204841417610c3b57610c3b613c9c565b63ffffffff82811682821603908082111561308357613083613c9c565b63ffffffff81811683821601908082111561308357613083613c9c565b6001600160601b03818116838216028082169190828114613d5257613d52613c9c565b505092915050565b81810381811115610c3b57610c3b613c9c565b67ffffffffffffffff831115613d8557613d856131fa565b613d9983613d938354613904565b8361393e565b6000601f841160018114613dcd5760008515613db55750838201355b600019600387901b1c1916600186901b178355613e27565b600083815260209020601f19861690835b82811015613dfe5786850135825560209485019460019092019101613dde565b5086821015613e1b5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008451613e4081846020890161351a565b845190830190613e5481836020890161351a565b7f2f0000000000000000000000000000000000000000000000000000000000000091019081528351613e8d81600184016020880161351a565b0160010195945050505050565b60008235605e19833603018112613eb057600080fd5b9190910192915050565b6000808335601e19843603018112613ed157600080fd5b83018035915067ffffffffffffffff821115613eec57600080fd5b6020019150606081023603821315613c9557600080fd5b69ffffffffffffffffffff81811683821601908082111561308357613083613c9c565b69ffffffffffffffffffff82811682821603908082111561308357613083613c9c565b606081526000613f5c60608301866136e9565b8281036020840152613f6e8186613af1565b90508281036040840152613f828185613af1565b9695505050505050565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220ff7fc85d1de57ac00d2392610abab44b1f4e5911ec73cc2d8957851b3061600564736f6c63430008110033000000000000000000000000a8863bf1c8933f649e7b03eb72109e5e187505ea
Deployed Bytecode
0x6080604052600436106101755760003560e01c80636d73e669116100cb5780639251cff41161007f578063f2fde38b11610059578063f2fde38b1461042c578063f3fef3a31461044c578063fbf522a31461046c57600080fd5b80639251cff4146103b6578063d7bf81a3146103d6578063e9dc6375146103ff57600080fd5b8063715018a6116100b0578063715018a61461034b578063895696f2146103605780638da5cb5b1461038e57600080fd5b80636d73e6691461030b5780636e12056a1461032b57600080fd5b806312c616121161012d57806331ae450b1161010757806331ae450b146102b657806333032dac146102d85780636c19e783146102eb57600080fd5b806312c616121461023257806324d7806c146102765780632d3456701461029657600080fd5b806308e845191161015e57806308e84519146101d15780630e136b19146101e45780630f79ab391461020557600080fd5b806301e5907e1461017a57806301ffc9a71461019c575b600080fd5b34801561018657600080fd5b5061019a61019536600461333a565b61048c565b005b3480156101a857600080fd5b506101bc6101b736600461342b565b610b3c565b60405190151581526020015b60405180910390f35b61019a6101df366004613455565b610c41565b3480156101f057600080fd5b506003546101bc90600160a01b900460ff1681565b34801561021157600080fd5b506102256102203660046134b6565b6114f6565b6040516101c89190613678565b34801561023e57600080fd5b5061025261024d36600461368b565b6116d6565b60408051825163ffffffff90811682526020938401511692810192909252016101c8565b34801561028257600080fd5b506101bc6102913660046136cc565b61174d565b3480156102a257600080fd5b5061019a6102b13660046136cc565b611786565b3480156102c257600080fd5b506102cb6117e4565b6040516101c8919061372d565b61019a6102e6366004613740565b611893565b3480156102f757600080fd5b5061019a6103063660046136cc565b611cbc565b34801561031757600080fd5b5061019a6103263660046136cc565b611d71565b34801561033757600080fd5b5061019a61034636600461377e565b611dc9565b34801561035757600080fd5b5061019a611f48565b34801561036c57600080fd5b5061038061037b3660046134b6565b611f5c565b6040516101c892919061381b565b34801561039a57600080fd5b506000546040516001600160a01b0390911681526020016101c8565b3480156103c257600080fd5b5061019a6103d1366004613842565b61215d565b3480156103e257600080fd5b506103f16601c6bf5263400081565b6040519081526020016101c8565b34801561040b57600080fd5b5061041f61041a3660046134b6565b61221c565b6040516101c8919061385f565b34801561043857600080fd5b5061019a6104473660046136cc565b61251a565b34801561045857600080fd5b5061019a6104673660046134b6565b6125a7565b34801561047857600080fd5b5061019a610487366004613872565b6126a6565b604051630935e01b60e21b8152336004820152839081906001600160a01b038216906324d7806c90602401602060405180830381865afa1580156104d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f891906138e7565b61055d5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084015b60405180910390fd5b600354600160a01b900460ff16156105885760405163d17e0deb60e01b815260040160405180910390fd5b60006105948686612ce2565b6040805161016081019091528154909190829060ff1660038111156105bb576105bb6134e2565b60038111156105cc576105cc6134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e09092019161064f90613904565b80601f016020809104026020016040519081016040528092919081815260200182805461067b90613904565b80156106c85780601f1061069d576101008083540402835291602001916106c8565b820191906000526020600020905b8154815290600101906020018083116106ab57829003601f168201915b505050918352505060028201546001600160a01b038082166020840152600160a01b9091046001600160601b03166040830152600390920154909116606090910152905084158061071f575066ffffffffffffff85115b1561073d5760405163603b655960e01b815260040160405180910390fd5b608084015165ffffffffffff16158015906107705750836080015165ffffffffffff16846060015165ffffffffffff1610155b1561078e576040516381bf7f6760e01b815260040160405180910390fd5b604084015163ffffffff16158015906107ba5750806020015163ffffffff16846040015163ffffffff16105b156107f1576040517fc7fb59c000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b63ffffffff846040015163ffffffff1611156108205760405163b4fa3fb360e01b815260040160405180910390fd5b600084516003811115610835576108356134e2565b036108535760405163cc14845760e01b815260040160405180910390fd5b6001600160601b038460a001516001600160601b031611156108885760405163b4fa3fb360e01b815260040160405180910390fd5b604051806101600160405280856000015160038111156108aa576108aa6134e2565b815260208381015163ffffffff908116828401526040888101519091168184015260608089015165ffffffffffff908116918501919091526080808a01519091169084015260a08086015169ffffffffffffffffffff168185015260c08087015160ff168186015289015160e0850152888301516001600160a01b03908116610100860152908901516001600160601b03166101208501526101408087015182169401939093529189166000908152600582528281208982529091522081518154829060ff19166001836003811115610985576109856134e2565b02179055506020820151815460408401516060850151608086015160a087015160c088015168ffffffffffffffff001990951661010063ffffffff9788160268ffffffff00000000001916176501000000000096909416959095029290921774ffffffffffffffffffffffff0000000000000000001916600160481b65ffffffffffff9283160274ffffffffffff000000000000000000000000000000191617600160781b91909216021774ffffffffffffffffffffffffffffffffffffffffff16600160a81b69ffffffffffffffffffff909316929092027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1691909117600160f81b60ff9092169190910217815560e08201516001820190610aa8908261398c565b506101008201516101208301516001600160601b0316600160a01b026001600160a01b03918216176002830155610140909201516003909101805491831673ffffffffffffffffffffffffffffffffffffffff199290921691909117905560405186918816907fcd514d5a4a2a03dfd7e4ea6e5ead7f67a401bef8aa4401e0d0c5143d3c15c56f90600090a3505050505050565b60006001600160e01b031982167fe130edc6000000000000000000000000000000000000000000000000000000001480610b9f57506001600160e01b031982167f45d70d3d00000000000000000000000000000000000000000000000000000000145b80610bd357506001600160e01b031982167fe9dc637500000000000000000000000000000000000000000000000000000000145b80610c0757506001600160e01b031982167f553e757e00000000000000000000000000000000000000000000000000000000145b80610c3b57506001600160e01b031982167f01ffc9a700000000000000000000000000000000000000000000000000000000145b92915050565b604051630935e01b60e21b8152336004820152839081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015610c89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cad91906138e7565b610d0d5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610554565b600354600160a01b900460ff1615610d385760405163d17e0deb60e01b815260040160405180910390fd5b831580610d4b575066ffffffffffffff84115b15610d695760405163603b655960e01b815260040160405180910390fd5b6001600160a01b038516600090815260056020908152604080832087845290915281205460ff166003811115610da157610da16134e2565b14610dd8576040517f8b6e785900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610de76020850185613a4c565b6003811115610df857610df86134e2565b03610e165760405163cc14845760e01b815260040160405180910390fd5b610e266080840160608501613a67565b65ffffffffffff1615801590610e6a5750610e476080840160608501613a67565b65ffffffffffff16610e5f6060850160408601613a67565b65ffffffffffff1610155b15610e88576040516381bf7f6760e01b815260040160405180910390fd5b63ffffffff610e9d6040850160208601613a82565b63ffffffff161115610ec25760405163b4fa3fb360e01b815260040160405180910390fd5b60ff610ed460a0850160808601613a9d565b60ff161115610ef65760405163b4fa3fb360e01b815260040160405180910390fd5b6001600160601b03610f0f610100850160e08601613ac0565b6001600160601b03161115610f375760405163b4fa3fb360e01b815260040160405180910390fd5b604080516001808252818301909252600091602080830190803683370190505090503381600081518110610f6d57610f6d613adb565b6001600160a01b03909216602092830291909101909101526000610f9760a0860160808701613a9d565b60ff1667ffffffffffffffff811115610fb257610fb26131fa565b604051908082528060200260200182016040528015610fdb578160200160208202803683370190505b5090506000610ff060a0870160808801613a9d565b60ff1667ffffffffffffffff81111561100b5761100b6131fa565b60405190808252806020026020018201604052801561103e57816020015b60608152602001906001900390816110295790505b5090506000886001600160a01b0316638c6e84728585856040518463ffffffff1660e01b815260040161107393929190613b21565b6000604051808303816000875af1158015611092573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110ba9190810190613ba8565b905069ffffffffffffffffffff816000815181106110da576110da613adb565b6020026020010151111561110157604051631763a91f60e21b815260040160405180910390fd5b6040805161016081019091528061111b60208a018a613a4c565b600381111561112c5761112c6134e2565b8152602001600063ffffffff1681526020018860200160208101906111519190613a82565b63ffffffff16815260200161116c60608a0160408b01613a67565b65ffffffffffff16815260200161118960808a0160608b01613a67565b65ffffffffffff168152602001826000815181106111a9576111a9613adb565b602002602001015169ffffffffffffffffffff1681526020018860800160208101906111d59190613a9d565b60ff1681526020016111ea60a08a018a613c4e565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161123460e08a0160c08b016136cc565b6001600160a01b031681526020016112536101008a0160e08b01613ac0565b6001600160601b031681526020016112736101208a016101008b016136cc565b6001600160a01b039081169091528a1660009081526005602090815260408083208c8452909152902081518154829060ff191660018360038111156112ba576112ba6134e2565b02179055506020820151815460408401516060850151608086015160a087015160c088015168ffffffffffffffff001990951661010063ffffffff9788160268ffffffff00000000001916176501000000000096909416959095029290921774ffffffffffffffffffffffff0000000000000000001916600160481b65ffffffffffff9283160274ffffffffffff000000000000000000000000000000191617600160781b91909216021774ffffffffffffffffffffffffffffffffffffffffff16600160a81b69ffffffffffffffffffff909316929092027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1691909117600160f81b60ff9092169190910217815560e082015160018201906113dd908261398c565b506101008201516101208301516001600160601b0316600160a01b026001600160a01b0391821617600283015561014090920151600390910180549190921673ffffffffffffffffffffffffffffffffffffffff199190911617905560005b61144c60a0890160808a01613a9d565b60ff168110156114aa576001600160a01b038a16600090815260066020526040812083518b929085908590811061148557611485613adb565b602002602001015181526020019081526020016000208190555080600101905061143c565b5060405133815288906001600160a01b038b16907fa86c2cb52a6fa7971af0717068d16ef16902ea3832013454c5f224cff78b7c799060200160405180910390a3505050505050505050565b604080516101608101825260008082526020820181905291810182905260608082018390526080820183905260a0820183905260c0820183905260e0820152610100810182905261012081018290526101408101919091526115588383612ce2565b6040805161016081019091528154909190829060ff16600381111561157f5761157f6134e2565b6003811115611590576115906134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e09092019161161390613904565b80601f016020809104026020016040519081016040528092919081815260200182805461163f90613904565b801561168c5780601f106116615761010080835404028352916020019161168c565b820191906000526020600020905b81548152906001019060200180831161166f57829003601f168201915b505050918352505060028201546001600160a01b038082166020840152600160a01b9091046001600160601b03166040830152600390920154909116606090910152905092915050565b604080518082018252600080825260208083018290528351808501855282815281018290526001600160a01b038087168352600482528483208684528252848320908816835281529083902083518085019094525463ffffffff80821685526401000000009091041690830152905b949350505050565b6000816001600160a01b031661176b6000546001600160a01b031690565b6001600160a01b03161480610c3b5750610c3b600183612d53565b61178e612d78565b611799600182612d53565b156117e15760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a36117df600182612dd2565b505b50565b60606117f06001612de7565b67ffffffffffffffff811115611808576118086131fa565b604051908082528060200260200182016040528015611831578160200160208202803683370190505b50905060005b6118416001612de7565b81101561188f57611853600182612df1565b82828151811061186557611865613adb565b6001600160a01b03909216602092830291909101909101528061188781613cb2565b915050611837565b5090565b333b156118cc576040517f2dd5679600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006118d88484612ce2565b905063ffffffff821615806118f7575063ffffffff8263ffffffff1610155b1561192e576040517fe59e82a200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805442600160481b90910465ffffffffffff16118061197757508054600160781b900465ffffffffffff16158015906119775750805442600160781b90910465ffffffffffff16105b156119ae576040517fc84651bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805465010000000000900463ffffffff16158015906119e457508054610100810463ffffffff9081166501000000000090920416145b15611a1b576040517fad6d3b4f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805463fffffffe1961010090910463ffffffff1601611a4d57604051638d83cdd760e01b815260040160405180910390fd5b600281015463ffffffff831690611a7c906601c6bf5263400090600160a01b90046001600160601b0316613ccb565b611a869190613cde565b3414611abe576040517f3c6b4b2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8054829065010000000000900463ffffffff1615611b0e578154611b0b9063ffffffff80861691611b0091610100820481169165010000000000900416613cf5565b63ffffffff16612dfd565b90505b815481908390600190611b2d908490610100900463ffffffff16613d12565b82546101009290920a63ffffffff8181021990931691831602179091556001600160a01b03871660009081526004602090815260408083208984528252808320338452909152812080548594509092611b8891859116613d12565b825463ffffffff9182166101009390930a92830291909202199091161790555060028201546001600160601b03600160a01b9091041615611c06576002820154611c06906001600160a01b03811690611bf89063ffffffff851690600160a01b90046001600160601b0316613d2f565b6001600160601b0316612e13565b8263ffffffff168163ffffffff1614611c6d57600282015460009063ffffffff831690611c4b906601c6bf5263400090600160a01b90046001600160601b0316613ccb565b611c559190613cde565b611c5f9034613d5a565b9050611c6b3382612e13565b505b60405163ffffffff82168152339085906001600160a01b038816907f8f86c88b5cf44f69cf04133c647fc1c3a88bffe5d6797f5f178a1432ab75daf59060200160405180910390a45050505050565b33611ccf6000546001600160a01b031690565b6001600160a01b03161480611cea5750611cea600133612d53565b611d425760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610554565b6003805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b611d79612d78565b611d84600182612d53565b6117e15760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a36117df600182612e3a565b604051630935e01b60e21b8152336004820152859081906001600160a01b038216906324d7806c90602401602060405180830381865afa158015611e11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3591906138e7565b611e955760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b6064820152608401610554565b6000611ea18888612ce2565b90506000866003811115611eb757611eb76134e2565b03611ed55760405163cc14845760e01b815260040160405180910390fd5b80548690829060ff19166001836003811115611ef357611ef36134e2565b021790555060018101611f07858783613d6d565b5060405187906001600160a01b038a16907fcd514d5a4a2a03dfd7e4ea6e5ead7f67a401bef8aa4401e0d0c5143d3c15c56f90600090a35050505050505050565b611f50612d78565b611f5a6000612e4f565b565b60408051610160810182526000808252602080830182905282840182905260608084018390526080840183905260a0840183905260c0840183905260e08401526101008301829052610120830182905261014083018290526001600160a01b0386168252600681528382208583529052919091205490611fdc8483612ce2565b6040805161016081019091528154909190829060ff166003811115612003576120036134e2565b6003811115612014576120146134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e09092019161209790613904565b80601f01602080910402602001604051908101604052809291908181526020018280546120c390613904565b80156121105780601f106120e557610100808354040283529160200191612110565b820191906000526020600020905b8154815290600101906020018083116120f357829003601f168201915b505050918352505060028201546001600160a01b038082166020840152600160a01b9091046001600160601b03166040830152600390920154909116606090910152919491935090915050565b336121706000546001600160a01b031690565b6001600160a01b0316148061218b575061218b600133612d53565b6121e35760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610554565b60038054911515600160a01b027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff909216919091179055565b6001600160a01b038216600090815260066020908152604080832084845290915281205460609181900361227c576040517f2c17b50900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006122888583612ce2565b6040805161016081019091528154909190829060ff1660038111156122af576122af6134e2565b60038111156122c0576122c06134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e09092019161234390613904565b80601f016020809104026020016040519081016040528092919081815260200182805461236f90613904565b80156123bc5780601f10612391576101008083540402835291602001916123bc565b820191906000526020600020905b81548152906001019060200180831161239f57829003601f168201915b50505091835250506002828101546001600160a01b03808216602080860191909152600160a01b9092046001600160601b0316604080860191909152600390950154166060909301929092528251918201909252600081529192508251600381111561242a5761242a6134e2565b03612469575060408051808201909152601481527f68747470733a2f2f617277656176652e6e65742f00000000000000000000000060208201526124b9565b60038251600381111561247e5761247e6134e2565b036124b9575060408051808201909152600781527f697066733a2f2f0000000000000000000000000000000000000000000000000060208201525b808260e001516124ee8460a0015169ffffffffffffffffffff16886124de9190613d5a565b6124e9906001613ccb565b612eac565b60405160200161250093929190613e2e565b604051602081830303815290604052935050505092915050565b612522612d78565b6001600160a01b03811661259e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610554565b6117e181612e4f565b336125ba6000546001600160a01b031690565b6001600160a01b031614806125d557506125d5600133612d53565b61262d5760405162461bcd60e51b8152602060048201526024808201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616044820152633236b4b760e11b6064820152608401610554565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461267a576040519150601f19603f3d011682016040523d82523d6000602084013e61267f565b606091505b50509050806126a15760405163f6a9b88f60e01b815260040160405180910390fd5b505050565b6126ae612f4c565b60005b818110156126a157368383838181106126cc576126cc613adb565b90506020028101906126de9190613e9a565b905060006126fc6126f260208401846136cc565b8360200135612ce2565b6040805161016081019091528154909190829060ff166003811115612723576127236134e2565b6003811115612734576127346134e2565b8152815463ffffffff61010082048116602084015265010000000000820416604083015265ffffffffffff600160481b820481166060840152600160781b820416608083015269ffffffffffffffffffff600160a81b82041660a083015260ff600160f81b9091041660c082015260018201805460e0909201916127b790613904565b80601f01602080910402602001604051908101604052809291908181526020018280546127e390613904565b80156128305780601f1061280557610100808354040283529160200191612830565b820191906000526020600020905b81548152906001019060200180831161281357829003601f168201915b505050918352505060028201546001600160a01b038082166020840152600160a01b9091046001600160601b03166040808401919091526003909301541660609091015290915060009061288690840184613eba565b905067ffffffffffffffff8111156128a0576128a06131fa565b6040519080825280602002602001820160405280156128c9578160200160208202803683370190505b50905060006128db6040850185613eba565b905067ffffffffffffffff8111156128f5576128f56131fa565b60405190808252806020026020018201604052801561291e578160200160208202803683370190505b50905060006129306040860186613eba565b905067ffffffffffffffff81111561294a5761294a6131fa565b604051908082528060200260200182016040528015612973578160200160208202803683370190505b50905060005b6129866040870187613eba565b9050811015612c62573661299d6040880188613eba565b838181106129ad576129ad613adb565b60600291909101915060ff90506129c76020830183613a9d565b60ff1611156129e95760405163124e3e7160e01b815260040160405180910390fd5b60006129f86020830183613a9d565b90508660c0015160ff168160ff161180612a15575060018160ff16105b15612a335760405163124e3e7160e01b815260040160405180910390fd5b6000612a4560608401604085016136cc565b905063ffffffff612a5c6040850160208601613a82565b63ffffffff161115612a8157604051638d83cdd760e01b815260040160405180910390fd5b6000612a936040850160208601613a82565b90506000600481612aa760208e018e6136cc565b6001600160a01b039081168252602080830193909352604091820160009081208f85013582528452828120918716815292529020805490915063ffffffff80821691612afd918591640100000000900416613d12565b63ffffffff161115612b3b576040517f40a375cd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b69ffffffffffffffffffff8a60a0015169ffffffffffffffffffff161115612b7657604051631763a91f60e21b815260040160405180910390fd5b60018460ff168b60a00151612b8b9190613f03565b612b959190613f26565b69ffffffffffffffffffff16878781518110612bb357612bb3613adb565b6020026020010181815250508163ffffffff16888781518110612bd857612bd8613adb565b60200260200101818152505082898781518110612bf757612bf7613adb565b6001600160a01b0390921660209283029190910190910152805482908290600490612c3290849063ffffffff64010000000090910416613d12565b92506101000a81548163ffffffff021916908363ffffffff16021790555085806001019650505050505050612979565b50612c7060208601866136cc565b6001600160a01b031663e6c884dc8483856040518463ffffffff1660e01b8152600401612c9f93929190613f49565b600060405180830381600087803b158015612cb957600080fd5b505af1158015612ccd573d6000803e3d6000fd5b5050600190970196506126b195505050505050565b6001600160a01b0382166000908152600560209081526040808320848452909152812090815460ff166003811115612d1c57612d1c6134e2565b03610c3b576040517f7f07ad4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b6000546001600160a01b03163314611f5a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610554565b6000612d71836001600160a01b038416612f90565b6000610c3b825490565b6000612d71838361308a565b6000818310612e0c5781612d71565b5090919050565b6001600160a01b03821661262d5760405163f6a9b88f60e01b815260040160405180910390fd5b6000612d71836001600160a01b0384166130b4565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60606000612eb983613103565b600101905060008167ffffffffffffffff811115612ed957612ed96131fa565b6040519080825280601f01601f191660200182016040528015612f03576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8504945084612f0d57509392505050565b6003546001600160a01b03163314611f5a576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526001830160205260408120548015613079576000612fb4600183613d5a565b8554909150600090612fc890600190613d5a565b905081811461302d576000866000018281548110612fe857612fe8613adb565b906000526020600020015490508087600001848154811061300b5761300b613adb565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061303e5761303e613f8c565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610c3b565b6000915050610c3b565b5092915050565b60008260000182815481106130a1576130a1613adb565b9060005260206000200154905092915050565b60008181526001830160205260408120546130fb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c3b565b506000610c3b565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000831061314c577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310613178576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061319657662386f26fc10000830492506010015b6305f5e10083106131ae576305f5e100830492506008015b61271083106131c257612710830492506004015b606483106131d4576064830492506002015b600a8310610c3b5760010192915050565b6001600160a01b03811681146117e157600080fd5b634e487b7160e01b600052604160045260246000fd5b60405160e0810167ffffffffffffffff81118282101715613233576132336131fa565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715613262576132626131fa565b604052919050565b80356004811061327957600080fd5b919050565b8035613279816131e5565b803563ffffffff8116811461327957600080fd5b803565ffffffffffff8116811461327957600080fd5b80356001600160601b038116811461327957600080fd5b600082601f8301126132db57600080fd5b813567ffffffffffffffff8111156132f5576132f56131fa565b613308601f8201601f1916602001613239565b81815284602083860101111561331d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561334f57600080fd5b833561335a816131e5565b925060208401359150604084013567ffffffffffffffff8082111561337e57600080fd5b9085019060e0828803121561339257600080fd5b61339a613210565b6133a38361326a565b81526133b16020840161327e565b60208201526133c260408401613289565b60408201526133d36060840161329d565b60608201526133e46080840161329d565b60808201526133f560a084016132b3565b60a082015260c08301358281111561340c57600080fd5b613418898286016132ca565b60c0830152508093505050509250925092565b60006020828403121561343d57600080fd5b81356001600160e01b031981168114612d7157600080fd5b60008060006060848603121561346a57600080fd5b8335613475816131e5565b925060208401359150604084013567ffffffffffffffff81111561349857600080fd5b840161012081870312156134ab57600080fd5b809150509250925092565b600080604083850312156134c957600080fd5b82356134d4816131e5565b946020939093013593505050565b634e487b7160e01b600052602160045260246000fd5b6004811061351657634e487b7160e01b600052602160045260246000fd5b9052565b60005b8381101561353557818101518382015260200161351d565b50506000910152565b6000815180845261355681602086016020860161351a565b601f01601f19169290920160200192915050565b600061016061357a8484516134f8565b6020830151613591602086018263ffffffff169052565b5060408301516135a9604086018263ffffffff169052565b5060608301516135c3606086018265ffffffffffff169052565b5060808301516135dd608086018265ffffffffffff169052565b5060a08301516135fb60a086018269ffffffffffffffffffff169052565b5060c083015161361060c086018260ff169052565b5060e08301518160e08601526136288286018261353e565b91505061010080840151613646828701826001600160a01b03169052565b5050610120838101516001600160601b031690850152610140928301516001600160a01b031692909301919091525090565b602081526000612d71602083018461356a565b6000806000606084860312156136a057600080fd5b83356136ab816131e5565b925060208401356136bb816131e5565b929592945050506040919091013590565b6000602082840312156136de57600080fd5b8135612d71816131e5565b600081518084526020808501945080840160005b838110156137225781516001600160a01b0316875295820195908201906001016136fd565b509495945050505050565b602081526000612d7160208301846136e9565b60008060006060848603121561375557600080fd5b8335613760816131e5565b92506020840135915061377560408501613289565b90509250925092565b60008060008060006080868803121561379657600080fd5b85356137a1816131e5565b9450602086013593506137b66040870161326a565b9250606086013567ffffffffffffffff808211156137d357600080fd5b818801915088601f8301126137e757600080fd5b8135818111156137f657600080fd5b89602082850101111561380857600080fd5b9699959850939650602001949392505050565b828152604060208201526000611745604083018461356a565b80151581146117e157600080fd5b60006020828403121561385457600080fd5b8135612d7181613834565b602081526000612d71602083018461353e565b6000806020838503121561388557600080fd5b823567ffffffffffffffff8082111561389d57600080fd5b818501915085601f8301126138b157600080fd5b8135818111156138c057600080fd5b8660208260051b85010111156138d557600080fd5b60209290920196919550909350505050565b6000602082840312156138f957600080fd5b8151612d7181613834565b600181811c9082168061391857607f821691505b60208210810361393857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156126a157600081815260208120601f850160051c810160208610156139655750805b601f850160051c820191505b8181101561398457828155600101613971565b505050505050565b815167ffffffffffffffff8111156139a6576139a66131fa565b6139ba816139b48454613904565b8461393e565b602080601f8311600181146139ef57600084156139d75750858301515b600019600386901b1c1916600185901b178555613984565b600085815260208120601f198616915b82811015613a1e578886015182559484019460019091019084016139ff565b5085821015613a3c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215613a5e57600080fd5b612d718261326a565b600060208284031215613a7957600080fd5b612d718261329d565b600060208284031215613a9457600080fd5b612d7182613289565b600060208284031215613aaf57600080fd5b813560ff81168114612d7157600080fd5b600060208284031215613ad257600080fd5b612d71826132b3565b634e487b7160e01b600052603260045260246000fd5b600081518084526020808501945080840160005b8381101561372257815187529582019590820190600101613b05565b606081526000613b3460608301866136e9565b602083820381850152613b478287613af1565b915083820360408501528185518084528284019150828160051b85010183880160005b83811015613b9857601f19878403018552613b8683835161353e565b94860194925090850190600101613b6a565b50909a9950505050505050505050565b60006020808385031215613bbb57600080fd5b825167ffffffffffffffff80821115613bd357600080fd5b818501915085601f830112613be757600080fd5b815181811115613bf957613bf96131fa565b8060051b9150613c0a848301613239565b8181529183018401918481019088841115613c2457600080fd5b938501935b83851015613c4257845182529385019390850190613c29565b98975050505050505050565b6000808335601e19843603018112613c6557600080fd5b83018035915067ffffffffffffffff821115613c8057600080fd5b602001915036819003821315613c9557600080fd5b9250929050565b634e487b7160e01b600052601160045260246000fd5b600060018201613cc457613cc4613c9c565b5060010190565b80820180821115610c3b57610c3b613c9c565b8082028115828204841417610c3b57610c3b613c9c565b63ffffffff82811682821603908082111561308357613083613c9c565b63ffffffff81811683821601908082111561308357613083613c9c565b6001600160601b03818116838216028082169190828114613d5257613d52613c9c565b505092915050565b81810381811115610c3b57610c3b613c9c565b67ffffffffffffffff831115613d8557613d856131fa565b613d9983613d938354613904565b8361393e565b6000601f841160018114613dcd5760008515613db55750838201355b600019600387901b1c1916600186901b178355613e27565b600083815260209020601f19861690835b82811015613dfe5786850135825560209485019460019092019101613dde565b5086821015613e1b5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008451613e4081846020890161351a565b845190830190613e5481836020890161351a565b7f2f0000000000000000000000000000000000000000000000000000000000000091019081528351613e8d81600184016020880161351a565b0160010195945050505050565b60008235605e19833603018112613eb057600080fd5b9190910192915050565b6000808335601e19843603018112613ed157600080fd5b83018035915067ffffffffffffffff821115613eec57600080fd5b6020019150606081023603821315613c9557600080fd5b69ffffffffffffffffffff81811683821601908082111561308357613083613c9c565b69ffffffffffffffffffff82811682821603908082111561308357613083613c9c565b606081526000613f5c60608301866136e9565b8281036020840152613f6e8186613af1565b90508281036040840152613f828185613af1565b9695505050505050565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220ff7fc85d1de57ac00d2392610abab44b1f4e5911ec73cc2d8957851b3061600564736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a8863bf1c8933f649e7b03eb72109e5e187505ea
-----Decoded View---------------
Arg [0] : initialOwner (address): 0xa8863bf1c8933f649e7b03Eb72109E5E187505Ea
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000a8863bf1c8933f649e7b03eb72109e5e187505ea
Loading...
Loading
Loading...
Loading
Net Worth in USD
$1,073.32
Net Worth in ETH
0.563303
Token Allocations
ETH
100.00%
MNT
0.00%
POL
0.00%
Multichain Portfolio | 34 Chains
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.