// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
enum OrderType {
// 0: no partial fills, anyone can execute
FULL_OPEN,
// 1: partial fills supported, anyone can execute
PARTIAL_OPEN,
// 2: no partial fills, only offerer or zone can execute
FULL_RESTRICTED,
// 3: partial fills supported, only offerer or zone can execute
PARTIAL_RESTRICTED,
// 4: contract order type
CONTRACT
}
enum BasicOrderType {
// 0: no partial fills, anyone can execute
ETH_TO_ERC721_FULL_OPEN,
// 1: partial fills supported, anyone can execute
ETH_TO_ERC721_PARTIAL_OPEN,
// 2: no partial fills, only offerer or zone can execute
ETH_TO_ERC721_FULL_RESTRICTED,
// 3: partial fills supported, only offerer or zone can execute
ETH_TO_ERC721_PARTIAL_RESTRICTED,
// 4: no partial fills, anyone can execute
ETH_TO_ERC1155_FULL_OPEN,
// 5: partial fills supported, anyone can execute
ETH_TO_ERC1155_PARTIAL_OPEN,
// 6: no partial fills, only offerer or zone can execute
ETH_TO_ERC1155_FULL_RESTRICTED,
// 7: partial fills supported, only offerer or zone can execute
ETH_TO_ERC1155_PARTIAL_RESTRICTED,
// 8: no partial fills, anyone can execute
ERC20_TO_ERC721_FULL_OPEN,
// 9: partial fills supported, anyone can execute
ERC20_TO_ERC721_PARTIAL_OPEN,
// 10: no partial fills, only offerer or zone can execute
ERC20_TO_ERC721_FULL_RESTRICTED,
// 11: partial fills supported, only offerer or zone can execute
ERC20_TO_ERC721_PARTIAL_RESTRICTED,
// 12: no partial fills, anyone can execute
ERC20_TO_ERC1155_FULL_OPEN,
// 13: partial fills supported, anyone can execute
ERC20_TO_ERC1155_PARTIAL_OPEN,
// 14: no partial fills, only offerer or zone can execute
ERC20_TO_ERC1155_FULL_RESTRICTED,
// 15: partial fills supported, only offerer or zone can execute
ERC20_TO_ERC1155_PARTIAL_RESTRICTED,
// 16: no partial fills, anyone can execute
ERC721_TO_ERC20_FULL_OPEN,
// 17: partial fills supported, anyone can execute
ERC721_TO_ERC20_PARTIAL_OPEN,
// 18: no partial fills, only offerer or zone can execute
ERC721_TO_ERC20_FULL_RESTRICTED,
// 19: partial fills supported, only offerer or zone can execute
ERC721_TO_ERC20_PARTIAL_RESTRICTED,
// 20: no partial fills, anyone can execute
ERC1155_TO_ERC20_FULL_OPEN,
// 21: partial fills supported, anyone can execute
ERC1155_TO_ERC20_PARTIAL_OPEN,
// 22: no partial fills, only offerer or zone can execute
ERC1155_TO_ERC20_FULL_RESTRICTED,
// 23: partial fills supported, only offerer or zone can execute
ERC1155_TO_ERC20_PARTIAL_RESTRICTED
}
enum BasicOrderRouteType {
// 0: provide Ether (or other native token) to receive offered ERC721 item.
ETH_TO_ERC721,
// 1: provide Ether (or other native token) to receive offered ERC1155 item.
ETH_TO_ERC1155,
// 2: provide ERC20 item to receive offered ERC721 item.
ERC20_TO_ERC721,
// 3: provide ERC20 item to receive offered ERC1155 item.
ERC20_TO_ERC1155,
// 4: provide ERC721 item to receive offered ERC20 item.
ERC721_TO_ERC20,
// 5: provide ERC1155 item to receive offered ERC20 item.
ERC1155_TO_ERC20
}
enum ItemType {
// 0: ETH on mainnet, MATIC on polygon, etc.
NATIVE,
// 1: ERC20 items (ERC777 and ERC20 analogues could also technically work)
ERC20,
// 2: ERC721 items
ERC721,
// 3: ERC1155 items
ERC1155,
// 4: ERC721 items where a number of tokenIds are supported
ERC721_WITH_CRITERIA,
// 5: ERC1155 items where a number of ids are supported
ERC1155_WITH_CRITERIA
}
enum Side {
// 0: Items that can be spent
OFFER,
// 1: Items that must be received
CONSIDERATION
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {
BasicOrderType,
ItemType,
OrderType,
Side
} from "./ConsiderationEnums.sol";
import {
CalldataPointer,
MemoryPointer
} from "../helpers/PointerLibraries.sol";
/**
* @dev An order contains eleven components: an offerer, a zone (or account that
* can cancel the order or restrict who can fulfill the order depending on
* the type), the order type (specifying partial fill support as well as
* restricted order status), the start and end time, a hash that will be
* provided to the zone when validating restricted orders, a salt, a key
* corresponding to a given conduit, a counter, and an arbitrary number of
* offer items that can be spent along with consideration items that must
* be received by their respective recipient.
*/
struct OrderComponents {
address offerer;
address zone;
OfferItem[] offer;
ConsiderationItem[] consideration;
OrderType orderType;
uint256 startTime;
uint256 endTime;
bytes32 zoneHash;
uint256 salt;
bytes32 conduitKey;
uint256 counter;
}
/**
* @dev An offer item has five components: an item type (ETH or other native
* tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and
* ERC1155), a token address, a dual-purpose "identifierOrCriteria"
* component that will either represent a tokenId or a merkle root
* depending on the item type, and a start and end amount that support
* increasing or decreasing amounts over the duration of the respective
* order.
*/
struct OfferItem {
ItemType itemType;
address token;
uint256 identifierOrCriteria;
uint256 startAmount;
uint256 endAmount;
}
/**
* @dev A consideration item has the same five components as an offer item and
* an additional sixth component designating the required recipient of the
* item.
*/
struct ConsiderationItem {
ItemType itemType;
address token;
uint256 identifierOrCriteria;
uint256 startAmount;
uint256 endAmount;
address payable recipient;
}
/**
* @dev A spent item is translated from a utilized offer item and has four
* components: an item type (ETH or other native tokens, ERC20, ERC721, and
* ERC1155), a token address, a tokenId, and an amount.
*/
struct SpentItem {
ItemType itemType;
address token;
uint256 identifier;
uint256 amount;
}
/**
* @dev A received item is translated from a utilized consideration item and has
* the same four components as a spent item, as well as an additional fifth
* component designating the required recipient of the item.
*/
struct ReceivedItem {
ItemType itemType;
address token;
uint256 identifier;
uint256 amount;
address payable recipient;
}
/**
* @dev For basic orders involving ETH / native / ERC20 <=> ERC721 / ERC1155
* matching, a group of six functions may be called that only requires a
* subset of the usual order arguments. Note the use of a "basicOrderType"
* enum; this represents both the usual order type as well as the "route"
* of the basic order (a simple derivation function for the basic order
* type is `basicOrderType = orderType + (4 * basicOrderRoute)`.)
*/
struct BasicOrderParameters {
// calldata offset
address considerationToken; // 0x24
uint256 considerationIdentifier; // 0x44
uint256 considerationAmount; // 0x64
address payable offerer; // 0x84
address zone; // 0xa4
address offerToken; // 0xc4
uint256 offerIdentifier; // 0xe4
uint256 offerAmount; // 0x104
BasicOrderType basicOrderType; // 0x124
uint256 startTime; // 0x144
uint256 endTime; // 0x164
bytes32 zoneHash; // 0x184
uint256 salt; // 0x1a4
bytes32 offererConduitKey; // 0x1c4
bytes32 fulfillerConduitKey; // 0x1e4
uint256 totalOriginalAdditionalRecipients; // 0x204
AdditionalRecipient[] additionalRecipients; // 0x224
bytes signature; // 0x244
// Total length, excluding dynamic array data: 0x264 (580)
}
/**
* @dev Basic orders can supply any number of additional recipients, with the
* implied assumption that they are supplied from the offered ETH (or other
* native token) or ERC20 token for the order.
*/
struct AdditionalRecipient {
uint256 amount;
address payable recipient;
}
/**
* @dev The full set of order components, with the exception of the counter,
* must be supplied when fulfilling more sophisticated orders or groups of
* orders. The total number of original consideration items must also be
* supplied, as the caller may specify additional consideration items.
*/
struct OrderParameters {
address offerer; // 0x00
address zone; // 0x20
OfferItem[] offer; // 0x40
ConsiderationItem[] consideration; // 0x60
OrderType orderType; // 0x80
uint256 startTime; // 0xa0
uint256 endTime; // 0xc0
bytes32 zoneHash; // 0xe0
uint256 salt; // 0x100
bytes32 conduitKey; // 0x120
uint256 totalOriginalConsiderationItems; // 0x140
// offer.length // 0x160
}
/**
* @dev Orders require a signature in addition to the other order parameters.
*/
struct Order {
OrderParameters parameters;
bytes signature;
}
/**
* @dev Advanced orders include a numerator (i.e. a fraction to attempt to fill)
* and a denominator (the total size of the order) in addition to the
* signature and other order parameters. It also supports an optional field
* for supplying extra data; this data will be provided to the zone if the
* order type is restricted and the zone is not the caller, or will be
* provided to the offerer as context for contract order types.
*/
struct AdvancedOrder {
OrderParameters parameters;
uint120 numerator;
uint120 denominator;
bytes signature;
bytes extraData;
}
/**
* @dev Orders can be validated (either explicitly via `validate`, or as a
* consequence of a full or partial fill), specifically cancelled (they can
* also be cancelled in bulk via incrementing a per-zone counter), and
* partially or fully filled (with the fraction filled represented by a
* numerator and denominator).
*/
struct OrderStatus {
bool isValidated;
bool isCancelled;
uint120 numerator;
uint120 denominator;
}
/**
* @dev A criteria resolver specifies an order, side (offer vs. consideration),
* and item index. It then provides a chosen identifier (i.e. tokenId)
* alongside a merkle proof demonstrating the identifier meets the required
* criteria.
*/
struct CriteriaResolver {
uint256 orderIndex;
Side side;
uint256 index;
uint256 identifier;
bytes32[] criteriaProof;
}
/**
* @dev A fulfillment is applied to a group of orders. It decrements a series of
* offer and consideration items, then generates a single execution
* element. A given fulfillment can be applied to as many offer and
* consideration items as desired, but must contain at least one offer and
* at least one consideration that match. The fulfillment must also remain
* consistent on all key parameters across all offer items (same offerer,
* token, type, tokenId, and conduit preference) as well as across all
* consideration items (token, type, tokenId, and recipient).
*/
struct Fulfillment {
FulfillmentComponent[] offerComponents;
FulfillmentComponent[] considerationComponents;
}
/**
* @dev Each fulfillment component contains one index referencing a specific
* order and another referencing a specific offer or consideration item.
*/
struct FulfillmentComponent {
uint256 orderIndex;
uint256 itemIndex;
}
/**
* @dev An execution is triggered once all consideration items have been zeroed
* out. It sends the item in question from the offerer to the item's
* recipient, optionally sourcing approvals from either this contract
* directly or from the offerer's chosen conduit if one is specified. An
* execution is not provided as an argument, but rather is derived via
* orders, criteria resolvers, and fulfillments (where the total number of
* executions will be less than or equal to the total number of indicated
* fulfillments) and returned as part of `matchOrders`.
*/
struct Execution {
ReceivedItem item;
address offerer;
bytes32 conduitKey;
}
/**
* @dev Restricted orders are validated post-execution by calling validateOrder
* on the zone. This struct provides context about the order fulfillment
* and any supplied extraData, as well as all order hashes fulfilled in a
* call to a match or fulfillAvailable method.
*/
struct ZoneParameters {
bytes32 orderHash;
address fulfiller;
address offerer;
SpentItem[] offer;
ReceivedItem[] consideration;
bytes extraData;
bytes32[] orderHashes;
uint256 startTime;
uint256 endTime;
bytes32 zoneHash;
}
/**
* @dev Zones and contract offerers can communicate which schemas they implement
* along with any associated metadata related to each schema.
*/
struct Schema {
uint256 id;
bytes metadata;
}
using StructPointers for OrderComponents global;
using StructPointers for OfferItem global;
using StructPointers for ConsiderationItem global;
using StructPointers for SpentItem global;
using StructPointers for ReceivedItem global;
using StructPointers for BasicOrderParameters global;
using StructPointers for AdditionalRecipient global;
using StructPointers for OrderParameters global;
using StructPointers for Order global;
using StructPointers for AdvancedOrder global;
using StructPointers for OrderStatus global;
using StructPointers for CriteriaResolver global;
using StructPointers for Fulfillment global;
using StructPointers for FulfillmentComponent global;
using StructPointers for Execution global;
using StructPointers for ZoneParameters global;
/**
* @dev This library provides a set of functions for converting structs to
* pointers.
*/
library StructPointers {
/**
* @dev Get a MemoryPointer from OrderComponents.
*
* @param obj The OrderComponents object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
OrderComponents memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from OrderComponents.
*
* @param obj The OrderComponents object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
OrderComponents calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from OfferItem.
*
* @param obj The OfferItem object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
OfferItem memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from OfferItem.
*
* @param obj The OfferItem object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
OfferItem calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from ConsiderationItem.
*
* @param obj The ConsiderationItem object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
ConsiderationItem memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from ConsiderationItem.
*
* @param obj The ConsiderationItem object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
ConsiderationItem calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from SpentItem.
*
* @param obj The SpentItem object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
SpentItem memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from SpentItem.
*
* @param obj The SpentItem object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
SpentItem calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from ReceivedItem.
*
* @param obj The ReceivedItem object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
ReceivedItem memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from ReceivedItem.
*
* @param obj The ReceivedItem object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
ReceivedItem calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from BasicOrderParameters.
*
* @param obj The BasicOrderParameters object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
BasicOrderParameters memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from BasicOrderParameters.
*
* @param obj The BasicOrderParameters object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
BasicOrderParameters calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from AdditionalRecipient.
*
* @param obj The AdditionalRecipient object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
AdditionalRecipient memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from AdditionalRecipient.
*
* @param obj The AdditionalRecipient object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
AdditionalRecipient calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from OrderParameters.
*
* @param obj The OrderParameters object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
OrderParameters memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from OrderParameters.
*
* @param obj The OrderParameters object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
OrderParameters calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from Order.
*
* @param obj The Order object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
Order memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from Order.
*
* @param obj The Order object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
Order calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from AdvancedOrder.
*
* @param obj The AdvancedOrder object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
AdvancedOrder memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from AdvancedOrder.
*
* @param obj The AdvancedOrder object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
AdvancedOrder calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from OrderStatus.
*
* @param obj The OrderStatus object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
OrderStatus memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from OrderStatus.
*
* @param obj The OrderStatus object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
OrderStatus calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from CriteriaResolver.
*
* @param obj The CriteriaResolver object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
CriteriaResolver memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from CriteriaResolver.
*
* @param obj The CriteriaResolver object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
CriteriaResolver calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from Fulfillment.
*
* @param obj The Fulfillment object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
Fulfillment memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from Fulfillment.
*
* @param obj The Fulfillment object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
Fulfillment calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from FulfillmentComponent.
*
* @param obj The FulfillmentComponent object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
FulfillmentComponent memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from FulfillmentComponent.
*
* @param obj The FulfillmentComponent object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
FulfillmentComponent calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from Execution.
*
* @param obj The Execution object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
Execution memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from Execution.
*
* @param obj The Execution object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
Execution calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a MemoryPointer from ZoneParameters.
*
* @param obj The ZoneParameters object.
*
* @return ptr The MemoryPointer.
*/
function toMemoryPointer(
ZoneParameters memory obj
) internal pure returns (MemoryPointer ptr) {
assembly {
ptr := obj
}
}
/**
* @dev Get a CalldataPointer from ZoneParameters.
*
* @param obj The ZoneParameters object.
*
* @return ptr The CalldataPointer.
*/
function toCalldataPointer(
ZoneParameters calldata obj
) internal pure returns (CalldataPointer ptr) {
assembly {
ptr := obj
}
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Gas optimized ECDSA wrapper.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ECDSA.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ECDSA.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol)
library ECDSA {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The signature is invalid.
error InvalidSignature();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The number which `s` must be less than in order for
/// the signature to be non-malleable.
bytes32 private constant _MALLEABILITY_THRESHOLD_PLUS_ONE =
0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* RECOVERY OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// Note: as of Solady version 0.0.68, these functions will
// revert upon recovery failure for more safety by default.
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the `signature`.
///
/// This function does NOT accept EIP-2098 short form signatures.
/// Use `recover(bytes32 hash, bytes32 r, bytes32 vs)` for EIP-2098
/// short form signatures instead.
function recover(bytes32 hash, bytes memory signature) internal view returns (address result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`.
mstore(0x40, mload(add(signature, 0x20))) // `r`.
mstore(0x60, mload(add(signature, 0x40))) // `s`.
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
and(
// If the signature is exactly 65 bytes in length.
eq(mload(signature), 65),
// If `s` in lower half order, such that the signature is not malleable.
lt(mload(0x60), _MALLEABILITY_THRESHOLD_PLUS_ONE)
), // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x00, // Start of output.
0x20 // Size of output.
)
)
result := mload(0x00)
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
if iszero(returndatasize()) {
mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the `signature`.
///
/// This function does NOT accept EIP-2098 short form signatures.
/// Use `recover(bytes32 hash, bytes32 r, bytes32 vs)` for EIP-2098
/// short form signatures instead.
function recoverCalldata(bytes32 hash, bytes calldata signature)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`.
calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`.
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
and(
// If the signature is exactly 65 bytes in length.
eq(signature.length, 65),
// If `s` in lower half order, such that the signature is not malleable.
lt(mload(0x60), _MALLEABILITY_THRESHOLD_PLUS_ONE)
), // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x00, // Start of output.
0x20 // Size of output.
)
)
result := mload(0x00)
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
if iszero(returndatasize()) {
mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the EIP-2098 short form signature defined by `r` and `vs`.
///
/// This function only accepts EIP-2098 short form signatures.
/// See: https://eips.ethereum.org/EIPS/eip-2098
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal view returns (address result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, add(shr(255, vs), 27)) // `v`.
mstore(0x40, r)
mstore(0x60, shr(1, shl(1, vs))) // `s`.
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
// If `s` in lower half order, such that the signature is not malleable.
lt(mload(0x60), _MALLEABILITY_THRESHOLD_PLUS_ONE), // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x00, // Start of output.
0x20 // Size of output.
)
)
result := mload(0x00)
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
if iszero(returndatasize()) {
mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the signature defined by `v`, `r`, `s`.
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, and(v, 0xff))
mstore(0x40, r)
mstore(0x60, s)
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
// If `s` in lower half order, such that the signature is not malleable.
lt(s, _MALLEABILITY_THRESHOLD_PLUS_ONE), // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x00, // Start of output.
0x20 // Size of output.
)
)
result := mload(0x00)
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
if iszero(returndatasize()) {
mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* TRY-RECOVER OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// WARNING!
// These functions will NOT revert upon recovery failure.
// Instead, they will return the zero address upon recovery failure.
// It is critical that the returned address is NEVER compared against
// a zero address (e.g. an uninitialized address variable).
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the `signature`.
///
/// This function does NOT accept EIP-2098 short form signatures.
/// Use `recover(bytes32 hash, bytes32 r, bytes32 vs)` for EIP-2098
/// short form signatures instead.
function tryRecover(bytes32 hash, bytes memory signature)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`.
mstore(0x40, mload(add(signature, 0x20))) // `r`.
mstore(0x60, mload(add(signature, 0x40))) // `s`.
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
and(
// If the signature is exactly 65 bytes in length.
eq(mload(signature), 65),
// If `s` in lower half order, such that the signature is not malleable.
lt(mload(0x60), _MALLEABILITY_THRESHOLD_PLUS_ONE)
), // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x40, // Start of output.
0x20 // Size of output.
)
)
mstore(0x60, 0) // Restore the zero slot.
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the `signature`.
///
/// This function does NOT accept EIP-2098 short form signatures.
/// Use `recover(bytes32 hash, bytes32 r, bytes32 vs)` for EIP-2098
/// short form signatures instead.
function tryRecoverCalldata(bytes32 hash, bytes calldata signature)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`.
calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`.
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
and(
// If the signature is exactly 65 bytes in length.
eq(signature.length, 65),
// If `s` in lower half order, such that the signature is not malleable.
lt(mload(0x60), _MALLEABILITY_THRESHOLD_PLUS_ONE)
), // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x40, // Start of output.
0x20 // Size of output.
)
)
mstore(0x60, 0) // Restore the zero slot.
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the EIP-2098 short form signature defined by `r` and `vs`.
///
/// This function only accepts EIP-2098 short form signatures.
/// See: https://eips.ethereum.org/EIPS/eip-2098
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, add(shr(255, vs), 27)) // `v`.
mstore(0x40, r)
mstore(0x60, shr(1, shl(1, vs))) // `s`.
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
// If `s` in lower half order, such that the signature is not malleable.
lt(mload(0x60), _MALLEABILITY_THRESHOLD_PLUS_ONE), // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x40, // Start of output.
0x20 // Size of output.
)
)
mstore(0x60, 0) // Restore the zero slot.
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the signature defined by `v`, `r`, `s`.
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, and(v, 0xff))
mstore(0x40, r)
mstore(0x60, s)
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
// If `s` in lower half order, such that the signature is not malleable.
lt(s, _MALLEABILITY_THRESHOLD_PLUS_ONE), // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x40, // Start of output.
0x20 // Size of output.
)
)
mstore(0x60, 0) // Restore the zero slot.
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
mstore(0x40, m) // Restore the free memory pointer.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* HASHING OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns an Ethereum Signed Message, created from a `hash`.
/// This produces a hash corresponding to the one signed with the
/// [`eth_sign`](https://eth.wiki/json-rpc/API#eth_sign)
/// JSON-RPC method as part of EIP-191.
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x20, hash) // Store into scratch space for keccak256.
mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32") // 28 bytes.
result := keccak256(0x04, 0x3c) // `32 * 2 - (32 - 28) = 60 = 0x3c`.
}
}
/// @dev Returns an Ethereum Signed Message, created from `s`.
/// This produces a hash corresponding to the one signed with the
/// [`eth_sign`](https://eth.wiki/json-rpc/API#eth_sign)
/// JSON-RPC method as part of EIP-191.
/// Note: Supports lengths of `s` up to 999999 bytes.
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let sLength := mload(s)
let o := 0x20
mstore(o, "\x19Ethereum Signed Message:\n") // 26 bytes, zero-right-padded.
mstore(0x00, 0x00)
// Convert the `s.length` to ASCII decimal representation: `base10(s.length)`.
for { let temp := sLength } 1 {} {
o := sub(o, 1)
mstore8(o, add(48, mod(temp, 10)))
temp := div(temp, 10)
if iszero(temp) { break }
}
let n := sub(0x3a, o) // Header length: `26 + 32 - o`.
// Throw an out-of-offset error (consumes all gas) if the header exceeds 32 bytes.
returndatacopy(returndatasize(), returndatasize(), gt(n, 0x20))
mstore(s, or(mload(0x00), mload(n))) // Temporarily store the header.
result := keccak256(add(s, sub(0x20, n)), add(n, sLength))
mstore(s, sLength) // Restore the length.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EMPTY CALLDATA HELPERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns an empty calldata bytes.
function emptySignature() internal pure returns (bytes calldata signature) {
/// @solidity memory-safe-assembly
assembly {
signature.length := 0
}
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {
ERC1155SeaDropContractOffererImplementation
} from "./ERC1155SeaDropContractOffererImplementation.sol";
import { PublicDrop, MultiConfigureStruct } from "./ERC1155SeaDropStructs.sol";
import { AllowListData, CreatorPayout } from "./SeaDropStructs.sol";
import {
IERC1155ContractMetadata
} from "../interfaces/IERC1155ContractMetadata.sol";
import { IERC1155SeaDrop } from "../interfaces/IERC1155SeaDrop.sol";
import { IERC173 } from "../interfaces/IERC173.sol";
/**
* @title ERC1155SeaDropConfigurer
* @author James Wenzel (emo.eth)
* @author Ryan Ghods (ralxz.eth)
* @author Stephan Min (stephanm.eth)
* @author Michael Cohen (notmichael.eth)
* @notice A helper contract to configure parameters for ERC1155SeaDrop.
*/
contract ERC1155SeaDropConfigurer is
ERC1155SeaDropContractOffererImplementation
{
/**
* @notice Revert with an error if the sender is not the owner
* of the token contract.
*/
error Unauthorized();
/**
* @dev Reverts if the sender is not the owner of the token.
*
* This is used as a function instead of a modifier
* to save contract space when used multiple times.
*/
function _onlyOwner(address token) internal view {
if (msg.sender != IERC173(token).owner()) {
revert Unauthorized();
}
}
/**
* @notice Configure multiple properties at a time.
*
* Only the owner of the token can use this function.
*
* Note: The individual configure methods should be used
* to unset or reset any properties to zero, as this method
* will ignore zero-value properties in the config struct.
*
* @param token The ERC1155SeaDrop contract address.
* @param config The configuration struct.
*/
function multiConfigure(
address token,
MultiConfigureStruct calldata config
) external {
// Ensure the sender is the owner of the token.
_onlyOwner(token);
if (config.maxSupplyTokenIds.length != 0) {
if (
config.maxSupplyTokenIds.length !=
config.maxSupplyAmounts.length
) {
revert MaxSupplyMismatch();
}
for (uint256 i = 0; i < config.maxSupplyTokenIds.length; ) {
IERC1155ContractMetadata(token).setMaxSupply(
config.maxSupplyTokenIds[i],
config.maxSupplyAmounts[i]
);
unchecked {
++i;
}
}
}
if (bytes(config.baseURI).length != 0) {
IERC1155ContractMetadata(token).setBaseURI(config.baseURI);
}
if (bytes(config.contractURI).length != 0) {
IERC1155ContractMetadata(token).setContractURI(config.contractURI);
}
if (config.provenanceHash != bytes32(0)) {
IERC1155ContractMetadata(token).setProvenanceHash(
config.provenanceHash
);
}
if (
_cast(config.royaltyReceiver != address(0)) &
_cast(config.royaltyBps != 0) ==
1
) {
IERC1155ContractMetadata(token).setDefaultRoyalty(
config.royaltyReceiver,
config.royaltyBps
);
}
if (config.publicDrops.length != 0) {
if (config.publicDrops.length != config.publicDropsIndexes.length) {
revert PublicDropsMismatch();
}
for (uint256 i = 0; i < config.publicDrops.length; ) {
IERC1155SeaDrop(address(token)).updatePublicDrop(
config.publicDrops[i],
config.publicDropsIndexes[i]
);
unchecked {
++i;
}
}
}
if (bytes(config.dropURI).length != 0) {
IERC1155SeaDrop(address(token)).updateDropURI(config.dropURI);
}
if (config.allowListData.merkleRoot != bytes32(0)) {
IERC1155SeaDrop(address(token)).updateAllowList(
config.allowListData
);
}
if (config.creatorPayouts.length != 0) {
IERC1155SeaDrop(address(token)).updateCreatorPayouts(
config.creatorPayouts
);
}
if (config.allowedFeeRecipients.length != 0) {
for (uint256 i = 0; i < config.allowedFeeRecipients.length; ) {
IERC1155SeaDrop(address(token)).updateAllowedFeeRecipient(
config.allowedFeeRecipients[i],
true
);
unchecked {
++i;
}
}
}
if (config.disallowedFeeRecipients.length != 0) {
for (uint256 i = 0; i < config.disallowedFeeRecipients.length; ) {
IERC1155SeaDrop(address(token)).updateAllowedFeeRecipient(
config.disallowedFeeRecipients[i],
false
);
unchecked {
++i;
}
}
}
if (config.allowedPayers.length != 0) {
for (uint256 i = 0; i < config.allowedPayers.length; ) {
IERC1155SeaDrop(address(token)).updatePayer(
config.allowedPayers[i],
true
);
unchecked {
++i;
}
}
}
if (config.disallowedPayers.length != 0) {
for (uint256 i = 0; i < config.disallowedPayers.length; ) {
IERC1155SeaDrop(address(token)).updatePayer(
config.disallowedPayers[i],
false
);
unchecked {
++i;
}
}
}
if (config.allowedSigners.length != 0) {
for (uint256 i = 0; i < config.allowedSigners.length; ) {
IERC1155SeaDrop(address(token)).updateSigner(
config.allowedSigners[i],
true
);
unchecked {
++i;
}
}
}
if (config.disallowedSigners.length != 0) {
for (uint256 i = 0; i < config.disallowedSigners.length; ) {
IERC1155SeaDrop(address(token)).updateSigner(
config.disallowedSigners[i],
false
);
unchecked {
++i;
}
}
}
if (config.mintTokenIds.length != 0) {
if (config.mintTokenIds.length != config.mintAmounts.length) {
revert MintAmountsMismatch();
}
IERC1155SeaDrop(token).multiConfigureMint(
config.mintRecipient,
config.mintTokenIds,
config.mintAmounts
);
}
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {
ERC1155SeaDropContractOffererStorage
} from "./ERC1155SeaDropContractOffererStorage.sol";
import {
MintDetails,
MintParams,
PublicDrop
} from "./ERC1155SeaDropStructs.sol";
import {
ERC1155SeaDropErrorsAndEvents
} from "./ERC1155SeaDropErrorsAndEvents.sol";
import { AllowListData, CreatorPayout } from "./SeaDropStructs.sol";
import { IERC1155SeaDrop } from "../interfaces/IERC1155SeaDrop.sol";
import { ISeaDropToken } from "../interfaces/ISeaDropToken.sol";
import { IDelegationRegistry } from "../interfaces/IDelegationRegistry.sol";
import { ItemType } from "seaport-types/src/lib/ConsiderationEnums.sol";
import {
ReceivedItem,
SpentItem,
Schema
} from "seaport-types/src/lib/ConsiderationStructs.sol";
import { ECDSA } from "solady/src/utils/ECDSA.sol";
/**
* @title ERC1155SeaDropContractOffererImplementation
* @author James Wenzel (emo.eth)
* @author Ryan Ghods (ralxz.eth)
* @author Stephan Min (stephanm.eth)
* @author Michael Cohen (notmichael.eth)
* @notice A helper contract that contains the implementation logic for
* ERC1155SeaDropContractOfferer, to help reduce contract size
* on the token contract itself.
*/
contract ERC1155SeaDropContractOffererImplementation is
ERC1155SeaDropErrorsAndEvents
{
using ERC1155SeaDropContractOffererStorage for ERC1155SeaDropContractOffererStorage.Layout;
/// @notice The delegation registry.
IDelegationRegistry public constant DELEGATION_REGISTRY =
IDelegationRegistry(0x00000000000076A84feF008CDAbe6409d2FE638B);
/// @notice The original address of this contract, to ensure that it can
/// only be called into with delegatecall.
address internal immutable _originalImplementation = address(this);
/// @notice Internal constants for EIP-712: Typed structured
/// data hashing and signing
bytes32 internal constant _SIGNED_MINT_TYPEHASH =
// prettier-ignore
keccak256(
"SignedMint("
"address minter,"
"address feeRecipient,"
"MintParams mintParams,"
"uint256 salt"
")"
"MintParams("
"uint256 startPrice,"
"uint256 endPrice,"
"uint256 startTime,"
"uint256 endTime,"
"address paymentToken,"
"uint256 fromTokenId,"
"uint256 toTokenId,"
"uint256 maxTotalMintableByWallet,"
"uint256 maxTotalMintableByWalletPerToken,"
"uint256 maxTokenSupplyForStage,"
"uint256 dropStageIndex,"
"uint256 feeBps,"
"bool restrictFeeRecipients"
")"
);
bytes32 internal constant _MINT_PARAMS_TYPEHASH =
// prettier-ignore
keccak256(
"MintParams("
"uint256 startPrice,"
"uint256 endPrice,"
"uint256 startTime,"
"uint256 endTime,"
"address paymentToken,"
"uint256 fromTokenId,"
"uint256 toTokenId,"
"uint256 maxTotalMintableByWallet,"
"uint256 maxTotalMintableByWalletPerToken,"
"uint256 maxTokenSupplyForStage,"
"uint256 dropStageIndex,"
"uint256 feeBps,"
"bool restrictFeeRecipients"
")"
);
bytes32 internal constant _EIP_712_DOMAIN_TYPEHASH =
// prettier-ignore
keccak256(
"EIP712Domain("
"string name,"
"string version,"
"uint256 chainId,"
"address verifyingContract"
")"
);
bytes32 internal constant _NAME_HASH = keccak256("ERC1155SeaDrop");
bytes32 internal constant _VERSION_HASH = keccak256("2.0");
/**
* @notice Constant for an unlimited `maxTokenSupplyForStage`.
* Used in `mintPublic` where no `maxTokenSupplyForStage`
* is stored in the `PublicDrop` struct.
*/
uint256 internal constant _UNLIMITED_MAX_TOKEN_SUPPLY_FOR_STAGE =
type(uint256).max;
/**
* @dev Constructor for contract deployment.
*/
constructor() {}
/**
* @notice The fallback function is used as a dispatcher for SeaDrop
* methods.
*/
fallback(bytes calldata) external returns (bytes memory output) {
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
// Get the function selector.
bytes4 selector = msg.sig;
// Get the rest of the msg data after the selector.
bytes calldata data = msg.data[4:];
if (selector == IERC1155SeaDrop.getPublicDrop.selector) {
// Get the public drop index.
uint256 publicDropIndex = uint256(bytes32(data[:32]));
// Return the public drop.
return
abi.encode(
ERC1155SeaDropContractOffererStorage.layout()._publicDrops[
publicDropIndex
]
);
} else if (selector == IERC1155SeaDrop.getPublicDropIndexes.selector) {
// Return the public drop indexes.
return
abi.encode(
ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedPublicDropIndexes
);
} else if (selector == ISeaDropToken.getAllowedSeaport.selector) {
// Return the allowed Seaport.
return
abi.encode(
ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedAllowedSeaport
);
} else if (selector == ISeaDropToken.getCreatorPayouts.selector) {
// Return the creator payouts.
return
abi.encode(
ERC1155SeaDropContractOffererStorage
.layout()
._creatorPayouts
);
} else if (selector == ISeaDropToken.getAllowListMerkleRoot.selector) {
// Return the creator payouts.
return
abi.encode(
ERC1155SeaDropContractOffererStorage
.layout()
._allowListMerkleRoot
);
} else if (selector == ISeaDropToken.getAllowedFeeRecipients.selector) {
// Return the allowed fee recipients.
return
abi.encode(
ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedFeeRecipients
);
} else if (selector == ISeaDropToken.getSigners.selector) {
// Return the allowed signers.
return
abi.encode(
ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedSigners
);
} else if (selector == ISeaDropToken.getDigestIsUsed.selector) {
// Get the digest.
bytes32 digest = bytes32(data[0:32]);
// Return if the digest is used.
return
abi.encode(
ERC1155SeaDropContractOffererStorage.layout()._usedDigests[
digest
]
);
} else if (selector == ISeaDropToken.getPayers.selector) {
// Return the allowed signers.
return
abi.encode(
ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedPayers
);
} else {
// Revert if the function selector is not supported.
revert UnsupportedFunctionSelector(selector);
}
}
/**
* @notice Returns the metadata for this contract offerer.
*
* @return name The name of the contract offerer.
* @return schemas The schemas supported by the contract offerer.
*/
function getSeaportMetadata()
external
pure
returns (
string memory name,
Schema[] memory schemas // map to Seaport Improvement Proposal IDs
)
{
name = "ERC1155SeaDrop";
schemas = new Schema[](1);
schemas[0].id = 12;
// Encode the SIP-12 substandards.
uint256[] memory substandards = new uint256[](3);
substandards[0] = 0;
substandards[1] = 1;
substandards[2] = 2;
schemas[0].metadata = abi.encode(substandards);
}
/**
* @notice Implementation function to emit an event to notify update of
* the drop URI.
*
* Do not use this method directly.
*
* @param dropURI The new drop URI.
*/
function updateDropURI(string calldata dropURI) external {
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
// Emit an event with the update.
emit DropURIUpdated(dropURI);
}
/**
* @notice Implementation function to update the public drop data and
* emit an event.
*
* Do not use this method directly.
*
* @param publicDrop The public drop data.
* @param index The index of the public drop.
*/
function updatePublicDrop(
PublicDrop calldata publicDrop,
uint256 index
) external {
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
// Revert if the fee basis points is greater than 10_000.
if (publicDrop.feeBps > 10_000) {
revert InvalidFeeBps(publicDrop.feeBps);
}
// Revert if the startTime is past the endTime.
if (publicDrop.startTime > publicDrop.endTime) {
revert InvalidStartAndEndTime(
publicDrop.startTime,
publicDrop.endTime
);
}
// Revert if the fromTokenId is greater than the toTokenId.
if (publicDrop.fromTokenId > publicDrop.toTokenId) {
revert InvalidFromAndToTokenId(
publicDrop.fromTokenId,
publicDrop.toTokenId
);
}
// Use maxTotalMintableByWallet != 0 as a signal that this update should
// add or update the drop stage, otherwise we will be removing.
bool addOrUpdateDropStage = publicDrop.maxTotalMintableByWallet != 0;
// Get pointers to the token gated drop data and enumerated addresses.
PublicDrop
storage existingDropStageData = ERC1155SeaDropContractOffererStorage
.layout()
._publicDrops[index];
uint256[]
storage enumeratedIndexes = ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedPublicDropIndexes;
// Stage struct packs to two slots, so load it
// as a uint256; if it is 0, it is empty.
bool dropStageDoesNotExist;
assembly {
dropStageDoesNotExist := iszero(
or(
sload(existingDropStageData.slot),
sload(add(existingDropStageData.slot, 1))
)
)
}
if (addOrUpdateDropStage) {
ERC1155SeaDropContractOffererStorage.layout()._publicDrops[
index
] = publicDrop;
// Add to enumeration if it does not exist already.
if (dropStageDoesNotExist) {
enumeratedIndexes.push(index);
}
} else {
// Check we are not deleting a drop stage that does not exist.
if (dropStageDoesNotExist) {
revert PublicDropStageNotPresent();
}
// Clear storage slot and remove from enumeration.
delete ERC1155SeaDropContractOffererStorage.layout()._publicDrops[
index
];
_removeFromEnumeration(index, enumeratedIndexes);
}
// Emit an event with the update.
emit PublicDropUpdated(publicDrop, index);
}
/**
* @notice Implementation function to update the allow list merkle root
* for the nft contract and emit an event.
*
* Do not use this method directly.
*
* @param allowListData The allow list data.
*/
function updateAllowList(AllowListData calldata allowListData) external {
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
// Put the previous root on the stack to use for the event.
bytes32 prevRoot = ERC1155SeaDropContractOffererStorage
.layout()
._allowListMerkleRoot;
// Update the merkle root.
ERC1155SeaDropContractOffererStorage
.layout()
._allowListMerkleRoot = allowListData.merkleRoot;
// Emit an event with the update.
emit AllowListUpdated(
prevRoot,
allowListData.merkleRoot,
allowListData.publicKeyURIs,
allowListData.allowListURI
);
}
/**
* @dev Implementation function to generate a mint order with the required
* consideration items.
*
* Do not use this method directly.
*
* @param fulfiller The address of the fulfiller.
* @param minimumReceived The minimum items that the caller must
* receive. To specify a range of ERC-1155
* tokens, use a null address ERC-1155 with
* the amount as the quantity.
* @custom:param maximumSpent Maximum items the caller is willing to
* spend. Must meet or exceed the requirement.
* @param context Context of the order according to SIP-12,
* containing the mint parameters.
*
* @return offer An array containing the offer items.
* @return consideration An array containing the consideration items.
*/
function generateOrder(
address fulfiller,
SpentItem[] calldata minimumReceived,
SpentItem[] calldata /* maximumSpent */,
bytes calldata context // encoded based on the schemaID
)
external
returns (SpentItem[] memory offer, ReceivedItem[] memory consideration)
{
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
// Only an allowed Seaport can call this function.
if (
!ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[
msg.sender
]
) {
revert InvalidCallerOnlyAllowedSeaport(msg.sender);
}
// Derive the offer and consideration with effects.
(offer, consideration) = _createOrder(
fulfiller,
minimumReceived,
context,
true
);
}
/**
* @dev Implementation view function to preview a mint order.
*
* Do not use this method directly.
*
* @custom:param caller The address of the caller (e.g. Seaport).
* @param fulfiller The address of the fulfiller.
* @param minimumReceived The minimum items that the caller must
* receive.
* @custom:param maximumSpent Maximum items the caller is willing to spend.
* Must meet or exceed the requirement.
* @param context Context of the order according to SIP-12,
* containing the mint parameters.
*
* @return offer An array containing the offer items.
* @return consideration An array containing the consideration items.
*/
function previewOrder(
address /* caller */,
address fulfiller,
SpentItem[] calldata minimumReceived,
SpentItem[] calldata /* maximumSpent */,
bytes calldata context
)
external
view
returns (SpentItem[] memory offer, ReceivedItem[] memory consideration)
{
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
// To avoid the solidity compiler complaining about calling a non-view
// function here (_createOrder), we will cast it as a view and use it.
// This is okay because we are not modifying any state when passing
// withEffects=false.
function(address, SpentItem[] calldata, bytes calldata, bool)
internal
view
returns (SpentItem[] memory, ReceivedItem[] memory) fn;
function(address, SpentItem[] calldata, bytes calldata, bool)
internal
returns (
SpentItem[] memory,
ReceivedItem[] memory
) fn2 = _createOrder;
assembly {
fn := fn2
}
// Derive the offer and consideration without effects.
(offer, consideration) = fn(fulfiller, minimumReceived, context, false);
}
/**
* @dev Decodes an order and returns the offer and substandard version.
*
* @param minimumReceived The minimum items that the caller must
* receive.
* @param context Context of the order according to SIP-12.
*/
function _decodeOrder(
SpentItem[] calldata minimumReceived,
bytes calldata context
) internal view returns (uint8 substandard) {
// Declare an error buffer; first check minimumReceived is not length
// zero and every minimumReceived has this address for token.
uint256 errorBuffer;
uint256 minimumReceivedLength = minimumReceived.length;
errorBuffer |= _castAndInvert(minimumReceivedLength > 0);
for (uint256 i = 0; i < minimumReceivedLength; ) {
errorBuffer |=
_castAndInvert(
minimumReceived[i].itemType == ItemType.ERC1155
) |
_castAndInvert(minimumReceived[i].token == address(this));
unchecked {
++i;
}
}
// Set the substandard version.
substandard = uint8(context[1]);
// Next, check for SIP-6 version byte.
errorBuffer |= _castAndInvert(context[0] == bytes1(0x00)) << 1;
// Next, check for supported substandard.
errorBuffer |= _castAndInvert(substandard < 3) << 2;
// Next, check for correct context length. Minimum is 43 bytes
// (version byte, substandard byte, feeRecipient, minter,
// publicDropIndex OR other substandard mint params)
unchecked {
errorBuffer |= _castAndInvert(context.length > 42) << 3;
}
// Handle decoding errors.
if (errorBuffer != 0) {
uint8 version = uint8(context[0]);
// We'll first revert with SIP-6 errors to follow spec.
// (`UnsupportedExtraDataVersion` and `InvalidExtraDataEncoding`)
if (errorBuffer << 254 != 0) {
revert UnsupportedExtraDataVersion(version);
} else if (errorBuffer << 252 != 0) {
revert InvalidExtraDataEncoding(version);
} else if (errorBuffer << 253 != 0) {
revert InvalidSubstandard(substandard);
} else {
// errorBuffer << 255 != 0
revert MustSpecifyERC1155ConsiderationItemForSeaDropMint();
}
}
}
/**
* @dev Creates an order with the required mint payment.
*
* @param fulfiller The fulfiller of the order.
* @param minimumReceived The minimum items that the caller must
* receive.
* @param context Context of the order according to SIP-12,
* containing the mint parameters.
* @param withEffects Whether to apply state changes of the mint.
*
* @return offer An array containing the offer items.
* @return consideration An array containing the consideration items.
*/
function _createOrder(
address fulfiller,
SpentItem[] calldata minimumReceived,
bytes calldata context,
bool withEffects
)
internal
returns (SpentItem[] memory offer, ReceivedItem[] memory consideration)
{
// Derive the substandard version.
uint8 substandard = _decodeOrder(minimumReceived, context);
// The offer is the minimumReceived which is validated in `_decodeOrder`.
offer = minimumReceived;
// All substandards have feeRecipient and minter as first two params.
address feeRecipient = address(bytes20(context[2:22]));
address minter = address(bytes20(context[22:42]));
// If the minter is the zero address, set it to the fulfiller.
if (minter == address(0)) {
minter = fulfiller;
}
// Start compiling the MintDetails struct to avoid stack too deep.
uint256 minimumReceivedLength = minimumReceived.length;
MintDetails memory mintDetails = MintDetails({
feeRecipient: feeRecipient,
payer: fulfiller,
minter: minter,
tokenIds: new uint256[](minimumReceivedLength),
quantities: new uint256[](minimumReceivedLength),
withEffects: withEffects
});
// Set the token ids and quantities.
for (uint256 i = 0; i < minimumReceivedLength; ) {
mintDetails.tokenIds[i] = minimumReceived[i].identifier;
mintDetails.quantities[i] = minimumReceived[i].amount;
unchecked {
++i;
}
}
if (substandard == 0) {
// 0: Public mint
uint8 publicDropIndex = uint8(bytes1(context[42:43]));
consideration = _mintPublic(mintDetails, publicDropIndex);
} else if (substandard == 1) {
// 1: Allow list mint
MintParams memory mintParams = abi.decode(
context[42:458],
(MintParams)
);
// Instead of putting the proof in memory, pass context and offset
// to use it directly from calldata.
consideration = _mintAllowList(
mintDetails,
mintParams,
context,
458
);
} else {
// substandard == 2
// 2: Signed mint
MintParams memory mintParams = abi.decode(
context[42:458],
(MintParams)
);
uint256 salt = uint256(bytes32(context[458:490]));
bytes32 signatureR = bytes32(context[490:522]);
bytes32 signatureVS = bytes32(context[522:554]);
consideration = _mintSigned(
mintDetails,
mintParams,
salt,
signatureR,
signatureVS
);
}
}
/**
* @notice Mint a public drop stage.
*
* @param mintDetails The mint details.
* @param publicDropIndex The public drop index to mint.
*/
function _mintPublic(
MintDetails memory mintDetails,
uint8 publicDropIndex
) internal returns (ReceivedItem[] memory consideration) {
// Get the public drop.
PublicDrop memory publicDrop = ERC1155SeaDropContractOffererStorage
.layout()
._publicDrops[publicDropIndex];
// Check that the tokenIds are within the range of the stage.
_checkTokenIds(
mintDetails.tokenIds,
publicDrop.fromTokenId,
publicDrop.toTokenId
);
// Check the number of mints are available
// and reduce quantity if needed..
uint256 totalQuantity = _checkMintQuantities(
mintDetails.tokenIds,
mintDetails.quantities,
mintDetails.minter,
publicDrop.maxTotalMintableByWallet,
publicDrop.maxTotalMintableByWalletPerToken,
_UNLIMITED_MAX_TOKEN_SUPPLY_FOR_STAGE
);
// Check that the stage is active and calculate the current price.
uint256 currentPrice = _currentPrice(
publicDrop.startTime,
publicDrop.endTime,
publicDrop.startPrice,
publicDrop.endPrice
);
// Validate the mint parameters.
// If passed withEffects=true, emits an event for analytics.
consideration = _validateMint(
mintDetails,
totalQuantity,
currentPrice,
publicDrop.paymentToken,
publicDrop.feeBps,
publicDropIndex,
publicDrop.restrictFeeRecipients
);
}
/**
* @notice Mint an allow list drop stage.
*
* @param mintDetails The mint details.
* @param mintParams The mint parameters.
* @param context The context of the order.
* @param proofOffsetInContext The offset of the proof in the context.
*/
function _mintAllowList(
MintDetails memory mintDetails,
MintParams memory mintParams,
bytes calldata context,
uint256 proofOffsetInContext
) internal returns (ReceivedItem[] memory consideration) {
// Verify the proof.
if (
!_verifyProof(
context,
proofOffsetInContext,
ERC1155SeaDropContractOffererStorage
.layout()
._allowListMerkleRoot,
keccak256(abi.encode(mintDetails.minter, mintParams))
)
) {
revert InvalidProof();
}
// Check that the tokenIds are within the range of the stage.
_checkTokenIds(
mintDetails.tokenIds,
mintParams.fromTokenId,
mintParams.toTokenId
);
// Check the number of mints are available.
uint256 totalQuantity = _checkMintQuantities(
mintDetails.tokenIds,
mintDetails.quantities,
mintDetails.minter,
mintParams.maxTotalMintableByWallet,
mintParams.maxTotalMintableByWalletPerToken,
mintParams.maxTokenSupplyForStage
);
// Check that the stage is active and calculate the current price.
uint256 currentPrice = _currentPrice(
mintParams.startTime,
mintParams.endTime,
mintParams.startPrice,
mintParams.endPrice
);
// Validate the mint parameters.
// If passed withEffects=true, emits an event for analytics.
consideration = _validateMint(
mintDetails,
totalQuantity,
currentPrice,
mintParams.paymentToken,
mintParams.feeBps,
mintParams.dropStageIndex,
mintParams.restrictFeeRecipients
);
}
/**
* @notice Mint with a server-side signature.
* Note that a signature can only be used once.
*
* @param mintDetails The mint details.
* @param mintParams The mint parameters.
* @param salt The salt for the signed mint.
* @param signatureR The server-side signature `r` value.
* @param signatureVS The server-side signature `vs` value.
*/
function _mintSigned(
MintDetails memory mintDetails,
MintParams memory mintParams,
uint256 salt,
bytes32 signatureR,
bytes32 signatureVS
) internal returns (ReceivedItem[] memory consideration) {
// Get the digest to verify the EIP-712 signature.
bytes32 digest = _getDigest(
mintDetails.minter,
mintDetails.feeRecipient,
mintParams,
salt
);
// Ensure the digest has not already been used.
if (
ERC1155SeaDropContractOffererStorage.layout()._usedDigests[digest]
) {
revert SignatureAlreadyUsed();
} else if (mintDetails.withEffects) {
// Mark the digest as used.
ERC1155SeaDropContractOffererStorage.layout()._usedDigests[
digest
] = true;
}
// Check that the tokenId is within the range of the stage.
_checkTokenIds(
mintDetails.tokenIds,
mintParams.fromTokenId,
mintParams.toTokenId
);
// Check the number of mints are available.
uint256 totalQuantity = _checkMintQuantities(
mintDetails.tokenIds,
mintDetails.quantities,
mintDetails.minter,
mintParams.maxTotalMintableByWallet,
mintParams.maxTotalMintableByWalletPerToken,
mintParams.maxTokenSupplyForStage
);
// Check that the stage is active and calculate the current price.
uint256 currentPrice = _currentPrice(
mintParams.startTime,
mintParams.endTime,
mintParams.startPrice,
mintParams.endPrice
);
// Validate the mint parameters.
// If passed withEffects=true, emits an event for analytics.
consideration = _validateMint(
mintDetails,
totalQuantity,
currentPrice,
mintParams.paymentToken,
mintParams.feeBps,
mintParams.dropStageIndex,
mintParams.restrictFeeRecipients
);
// Use the recover method to see what address was used to create
// the signature on this data.
// Note that if the digest doesn't exactly match what was signed we'll
// get a random recovered address.
address recoveredAddress = ECDSA.recover(
digest,
signatureR,
signatureVS
);
if (
!ERC1155SeaDropContractOffererStorage.layout()._allowedSigners[
recoveredAddress
]
) {
revert ECDSA.InvalidSignature();
}
}
/**
* @dev Validates a mint, reverting if the mint is invalid.
* If withEffects=true, sets mint recipient and emits an event.
*
* @param mintDetails The mint details.
* @param totalQuantity The total quantity of tokens to mint.
* @param currentPrice The current price of the stage.
* @param paymentToken The payment token.
* @param feeBps The fee basis points.
* @param dropStageIndex The drop stage index.
* @param restrictFeeRecipients Whether to restrict fee recipients.
*/
function _validateMint(
MintDetails memory mintDetails,
uint256 totalQuantity,
uint256 currentPrice,
address paymentToken,
uint256 feeBps,
uint256 dropStageIndex,
bool restrictFeeRecipients
) internal returns (ReceivedItem[] memory consideration) {
// Check the payer is allowed.
_checkPayerIsAllowed(mintDetails.payer, mintDetails.minter);
// Check that the fee recipient is allowed if restricted.
_checkFeeRecipientIsAllowed(
mintDetails.feeRecipient,
restrictFeeRecipients
);
// Set the required consideration items.
consideration = _requiredConsideration(
mintDetails.feeRecipient,
feeBps,
totalQuantity,
currentPrice,
paymentToken
);
// Apply the state changes of the mint.
if (mintDetails.withEffects) {
// Emit an event for the mint, for analytics.
emit SeaDropMint(mintDetails.payer, dropStageIndex);
}
}
/**
* @dev Internal view function to derive the current price of a stage
* based on the the starting price and ending price. If the start
* and end prices differ, the current price will be interpolated on
* a linear basis.
*
* Since this function is only used for consideration items, it will
* round up.
*
* @param startTime The starting time of the stage.
* @param endTime The end time of the stage.
* @param startPrice The starting price of the stage.
* @param endPrice The ending price of the stage.
*
* @return price The current price.
*/
function _currentPrice(
uint256 startTime,
uint256 endTime,
uint256 startPrice,
uint256 endPrice
) internal view returns (uint256 price) {
// Check that the drop stage has started and not ended.
// This ensures that the startTime is not greater than the current
// block timestamp and endTime is greater than the current block
// timestamp. If this condition is not upheld `duration`, `elapsed`,
// and `remaining` variables will underflow.
_checkActive(startTime, endTime);
// Return the price if startPrice == endPrice.
if (startPrice == endPrice) {
return endPrice;
}
// Declare variables to derive in the subsequent unchecked scope.
uint256 duration;
uint256 elapsed;
uint256 remaining;
// Skip underflow checks as startTime <= block.timestamp < endTime.
unchecked {
// Derive the duration for the stage and place it on the stack.
duration = endTime - startTime;
// Derive time elapsed since the stage started & place on stack.
elapsed = block.timestamp - startTime;
// Derive time remaining until stage expires and place on stack.
remaining = duration - elapsed;
}
// Aggregate new amounts weighted by time with rounding factor.
uint256 totalBeforeDivision = ((startPrice * remaining) +
(endPrice * elapsed));
// Use assembly to combine operations and skip divide-by-zero check.
assembly {
// Multiply by iszero(iszero(totalBeforeDivision)) to ensure
// amount is set to zero if totalBeforeDivision is zero,
// as intermediate overflow can occur if it is zero.
price := mul(
iszero(iszero(totalBeforeDivision)),
// Subtract 1 from the numerator and add 1 to the result
// to get the proper rounding direction to round up.
// Division is performed with no zero check as duration
// cannot be zero as long as startTime < endTime.
add(div(sub(totalBeforeDivision, 1), duration), 1)
)
}
}
/**
* @notice Check that the token ids are within the stage range.
*
* @param tokenIds The token ids.
* @param fromTokenId The drop stage start token id
* @param toTokenId The drop stage end token id.
*/
function _checkTokenIds(
uint256[] memory tokenIds,
uint256 fromTokenId,
uint256 toTokenId
) internal pure {
uint256 tokenIdsLength = tokenIds.length;
for (uint256 i = 0; i < tokenIdsLength; ) {
if (
_cast(tokenIds[i] < fromTokenId) |
_cast(tokenIds[i] > toTokenId) ==
1
) {
// Revert if the token id is not within range.
revert TokenIdNotWithinDropStageRange(
tokenIds[i],
fromTokenId,
toTokenId
);
}
unchecked {
++i;
}
}
}
/**
* @notice Check that the drop stage is active.
*
* @param startTime The drop stage start time.
* @param endTime The drop stage end time.
*/
function _checkActive(uint256 startTime, uint256 endTime) internal view {
// Define a variable if the drop stage is inactive.
bool inactive;
// Using the same check for time boundary from Seaport.
// startTime <= block.timestamp < endTime
assembly {
inactive := or(
iszero(gt(endTime, timestamp())),
gt(startTime, timestamp())
)
}
// Revert if the drop stage is not active.
if (inactive) {
revert NotActive(block.timestamp, startTime, endTime);
}
}
/**
* @notice Check that the fee recipient is allowed.
*
* @param feeRecipient The fee recipient.
* @param restrictFeeRecipients If the fee recipients are restricted.
*/
function _checkFeeRecipientIsAllowed(
address feeRecipient,
bool restrictFeeRecipients
) internal view {
// Ensure the fee recipient is not the zero address.
if (feeRecipient == address(0)) {
revert FeeRecipientCannotBeZeroAddress();
}
// Revert if the fee recipient is restricted and not allowed.
if (restrictFeeRecipients)
if (
!ERC1155SeaDropContractOffererStorage
.layout()
._allowedFeeRecipients[feeRecipient]
) {
revert FeeRecipientNotAllowed(feeRecipient);
}
}
/**
* @notice Check that the payer is allowed when not the minter.
*
* @param payer The payer.
* @param minter The minter.
*/
function _checkPayerIsAllowed(address payer, address minter) internal view {
if (
// Note: not using _cast pattern here to short-circuit
// and skip loading the allowed payers or delegation registry.
payer != minter &&
!ERC1155SeaDropContractOffererStorage.layout()._allowedPayers[
payer
] &&
!DELEGATION_REGISTRY.checkDelegateForAll(payer, minter)
) {
revert PayerNotAllowed(payer);
}
}
/**
* @notice Check that the wallet is allowed to mint the desired quantities.
*
* @param tokenIds The token ids.
* @param quantities The number of tokens to mint per token id.
* @param minter The mint recipient.
* @param maxTotalMintableByWallet The max allowed mints per wallet.
* @param maxTotalMintableByWalletPerToken The max allowed mints per wallet per token.
* @param maxTokenSupplyForStage The max token supply for the drop stage.
*/
function _checkMintQuantities(
uint256[] memory tokenIds,
uint256[] memory quantities,
address minter,
uint256 maxTotalMintableByWallet,
uint256 maxTotalMintableByWalletPerToken,
uint256 maxTokenSupplyForStage
) internal view returns (uint256 totalQuantity) {
// Put the token ids length on the stack.
uint256 tokenIdsLength = tokenIds.length;
// Define an array of seenTokenIds to ensure there are no duplicates.
uint256[] memory seenTokenIds = new uint256[](tokenIdsLength);
uint256 seenTokenIdsCurrentLength;
for (uint256 i = 0; i < tokenIdsLength; ) {
// Put the tokenId and quantity on the stack.
uint256 tokenId = tokenIds[i];
uint256 quantity = quantities[i];
// Revert if the offer contains duplicate token ids.
for (uint256 j = 0; j < seenTokenIdsCurrentLength; ) {
if (tokenId == seenTokenIds[j]) {
revert OfferContainsDuplicateTokenId(tokenId);
}
unchecked {
++j;
}
}
// Add to seen token ids.
seenTokenIds[i] = tokenId;
seenTokenIdsCurrentLength += 1;
// Add to total mint quantity.
totalQuantity += quantity;
// Check the mint quantities.
_checkMintQuantity(
tokenId,
quantity,
// Only check totalQuantity on the last iteration.
i == tokenIdsLength - 1 ? totalQuantity : 0,
minter,
maxTotalMintableByWallet,
maxTotalMintableByWalletPerToken,
maxTokenSupplyForStage
);
unchecked {
++i;
}
}
}
/**
* @notice Check that the wallet is allowed to mint the desired quantity.
*
* @param tokenId The token id.
* @param quantity The number of tokens to mint.
* @param totalQuantity When provided as a nonzero value ensures
* doesn't exceed maxTotalMintableByWallet.
* @param minter The mint recipient.
* @param maxTotalMintableByWallet The max allowed mints per wallet.
* @param maxTotalMintableByWalletPerToken The max allowed mints per wallet per token.
* @param maxTokenSupplyForStage The max token supply for the drop stage.
*/
function _checkMintQuantity(
uint256 tokenId,
uint256 quantity,
uint256 totalQuantity,
address minter,
uint256 maxTotalMintableByWallet,
uint256 maxTotalMintableByWalletPerToken,
uint256 maxTokenSupplyForStage
) internal view {
// Get the mint stats from the token contract.
(
uint256 minterNumMinted,
uint256 minterNumMintedForTokenId,
uint256 totalMintedForTokenId,
uint256 maxSupply
) = IERC1155SeaDrop(address(this)).getMintStats(minter, tokenId);
// Ensure mint quantity doesn't exceed maxTotalMintableByWalletPerToken.
if (
quantity + minterNumMintedForTokenId >
maxTotalMintableByWalletPerToken
) {
revert MintQuantityExceedsMaxMintedPerWalletForTokenId(
tokenId,
quantity + minterNumMinted,
maxTotalMintableByWalletPerToken
);
}
// Ensure mint quantity doesn't exceed maxSupply.
if (quantity + totalMintedForTokenId > maxSupply) {
revert MintQuantityExceedsMaxSupply(
quantity + totalMintedForTokenId,
maxSupply
);
}
// Ensure mint quantity doesn't exceed maxTokenSupplyForStage.
if (quantity + totalMintedForTokenId > maxTokenSupplyForStage) {
revert MintQuantityExceedsMaxTokenSupplyForStage(
quantity + totalMintedForTokenId,
maxTokenSupplyForStage
);
}
// If totalQuantity is provided, ensure it doesn't exceed maxTotalMintableByWallet.
if (totalQuantity != 0) {
// Ensure total mint quantity doesn't exceed maxTotalMintableByWallet.
if (totalQuantity + minterNumMinted > maxTotalMintableByWallet) {
revert MintQuantityExceedsMaxMintedPerWallet(
totalQuantity + minterNumMinted,
maxTotalMintableByWallet
);
}
} else {
// Otherwise, just check the quantity.
// Ensure mint quantity doesn't exceed maxTotalMintableByWallet.
if (quantity + minterNumMinted > maxTotalMintableByWallet) {
revert MintQuantityExceedsMaxMintedPerWallet(
quantity + minterNumMinted,
maxTotalMintableByWallet
);
}
}
}
/**
* @notice Derive the required consideration items for the mint,
* includes the fee recipient and creator payouts.
*
* @param feeRecipient The fee recipient.
* @param feeBps The fee basis points.
* @param quantity The total number of tokens to mint.
* @param currentPrice The current price of each token.
* @param paymentToken The payment token.
*/
function _requiredConsideration(
address feeRecipient,
uint256 feeBps,
uint256 quantity,
uint256 currentPrice,
address paymentToken
) internal view returns (ReceivedItem[] memory receivedItems) {
// If the mint price is zero, return early as there
// are no required consideration items.
if (currentPrice == 0) {
return new ReceivedItem[](0);
}
// Revert if the fee basis points are greater than 10_000.
if (feeBps > 10_000) {
revert InvalidFeeBps(feeBps);
}
// Set the itemType.
ItemType itemType = paymentToken == address(0)
? ItemType.NATIVE
: ItemType.ERC20;
// Put the total mint price on the stack.
uint256 totalPrice = quantity * currentPrice;
// Get the fee amount.
// Note that the fee amount is rounded down in favor of the creator.
uint256 feeAmount = (totalPrice * feeBps) / 10_000;
// Get the creator payout amount.
// Fee amount is <= totalPrice per above.
uint256 payoutAmount;
unchecked {
payoutAmount = totalPrice - feeAmount;
}
// Put the creator payouts on the stack.
CreatorPayout[]
storage creatorPayouts = ERC1155SeaDropContractOffererStorage
.layout()
._creatorPayouts;
// Put the length of total creator payouts on the stack.
uint256 creatorPayoutsLength = creatorPayouts.length;
// Revert if the creator payouts are not set.
if (creatorPayoutsLength == 0) {
revert CreatorPayoutsNotSet();
}
// Put the start index including the fee on the stack.
uint256 startIndexWithFee = feeAmount != 0 ? 1 : 0;
// Initialize the returned array with the correct length.
receivedItems = new ReceivedItem[](
startIndexWithFee + (payoutAmount != 0 ? creatorPayoutsLength : 0)
);
// Add a consideration item for the fee recipient.
if (feeAmount != 0) {
receivedItems[0] = ReceivedItem({
itemType: itemType,
token: paymentToken,
identifier: uint256(0),
amount: feeAmount,
recipient: payable(feeRecipient)
});
}
// Add a consideration item for each creator payout.
if (payoutAmount != 0) {
for (uint256 i = 0; i < creatorPayoutsLength; ) {
// Put the creator payout on the stack.
CreatorPayout memory creatorPayout = creatorPayouts[i];
// Get the creator payout amount.
// Note that the payout amount is rounded down.
uint256 creatorPayoutAmount = (payoutAmount *
creatorPayout.basisPoints) / 10_000;
receivedItems[startIndexWithFee + i] = ReceivedItem({
itemType: itemType,
token: paymentToken,
identifier: uint256(0),
amount: creatorPayoutAmount,
recipient: payable(creatorPayout.payoutAddress)
});
unchecked {
++i;
}
}
}
}
/**
* @dev Internal view function to derive the EIP-712 domain separator.
*
* @return The derived domain separator.
*/
function _deriveDomainSeparator() internal view returns (bytes32) {
// prettier-ignore
return keccak256(
abi.encode(
_EIP_712_DOMAIN_TYPEHASH,
_NAME_HASH,
_VERSION_HASH,
block.chainid,
address(this)
)
);
}
/**
* @notice Implementation function to update the allowed Seaport contracts.
*
* Do not use this method directly.
*
* @param allowedSeaport The allowed Seaport addresses.
*/
function updateAllowedSeaport(address[] calldata allowedSeaport) external {
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
// Put the lengths on the stack for more efficient access.
uint256 allowedSeaportLength = allowedSeaport.length;
uint256 enumeratedAllowedSeaportLength = ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedAllowedSeaport
.length;
// Reset the old mapping.
for (uint256 i = 0; i < enumeratedAllowedSeaportLength; ) {
ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[
ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedAllowedSeaport[i]
] = false;
unchecked {
++i;
}
}
// Set the new mapping for allowed Seaport contracts.
for (uint256 i = 0; i < allowedSeaportLength; ) {
// Ensure the allowed Seaport address is not the zero address.
if (allowedSeaport[i] == address(0)) {
revert AllowedSeaportCannotBeZeroAddress();
}
ERC1155SeaDropContractOffererStorage.layout()._allowedSeaport[
allowedSeaport[i]
] = true;
unchecked {
++i;
}
}
// Set the enumeration.
ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedAllowedSeaport = allowedSeaport;
// Emit an event for the update.
emit AllowedSeaportUpdated(allowedSeaport);
}
/**
* @notice Updates the creator payouts and emits an event.
* The basis points must add up to 10_000 exactly.
*
* @param creatorPayouts The creator payout address and basis points.
*/
function updateCreatorPayouts(
CreatorPayout[] calldata creatorPayouts
) external {
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
// Reset the creator payout array.
delete ERC1155SeaDropContractOffererStorage.layout()._creatorPayouts;
// Track the total basis points.
uint256 totalBasisPoints;
// Put the total creator payouts length on the stack.
uint256 creatorPayoutsLength = creatorPayouts.length;
// Revert if no creator payouts were provided.
if (creatorPayoutsLength == 0) {
revert CreatorPayoutsNotSet();
}
for (uint256 i; i < creatorPayoutsLength; ) {
// Get the creator payout.
CreatorPayout memory creatorPayout = creatorPayouts[i];
// Ensure the creator payout address is not the zero address.
if (creatorPayout.payoutAddress == address(0)) {
revert CreatorPayoutAddressCannotBeZeroAddress();
}
// Ensure the basis points are not zero.
if (creatorPayout.basisPoints == 0) {
revert CreatorPayoutBasisPointsCannotBeZero();
}
// Add to the total basis points.
totalBasisPoints += creatorPayout.basisPoints;
// Push to storage.
ERC1155SeaDropContractOffererStorage.layout()._creatorPayouts.push(
creatorPayout
);
unchecked {
++i;
}
}
// Ensure the total basis points equals 10_000 exactly.
if (totalBasisPoints != 10_000) {
revert InvalidCreatorPayoutTotalBasisPoints(totalBasisPoints);
}
// Emit an event with the update.
emit CreatorPayoutsUpdated(creatorPayouts);
}
/**
* @notice Updates the allowed fee recipient and emits an event.
*
* @param feeRecipient The fee recipient.
* @param allowed If the fee recipient is allowed.
*/
function updateAllowedFeeRecipient(
address feeRecipient,
bool allowed
) external {
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
if (feeRecipient == address(0)) {
revert FeeRecipientCannotBeZeroAddress();
}
// Track the enumerated storage.
address[]
storage enumeratedStorage = ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedFeeRecipients;
mapping(address => bool)
storage feeRecipientsMap = ERC1155SeaDropContractOffererStorage
.layout()
._allowedFeeRecipients;
if (allowed) {
if (feeRecipientsMap[feeRecipient]) {
revert DuplicateFeeRecipient();
}
feeRecipientsMap[feeRecipient] = true;
enumeratedStorage.push(feeRecipient);
} else {
if (!feeRecipientsMap[feeRecipient]) {
revert FeeRecipientNotPresent();
}
delete ERC1155SeaDropContractOffererStorage
.layout()
._allowedFeeRecipients[feeRecipient];
_asAddressArray(_removeFromEnumeration)(
feeRecipient,
enumeratedStorage
);
}
// Emit an event with the update.
emit AllowedFeeRecipientUpdated(feeRecipient, allowed);
}
/**
* @notice Updates the allowed server-side signer and emits an event.
*
* @param signer The signer to update.
* @param allowed Whether the signer is allowed.
*/
function updateSigner(address signer, bool allowed) external {
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
if (signer == address(0)) {
revert SignerCannotBeZeroAddress();
}
// Track the enumerated storage.
address[]
storage enumeratedStorage = ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedSigners;
mapping(address => bool)
storage signersMap = ERC1155SeaDropContractOffererStorage
.layout()
._allowedSigners;
if (allowed) {
if (signersMap[signer]) {
revert DuplicateSigner();
}
signersMap[signer] = true;
enumeratedStorage.push(signer);
} else {
if (!signersMap[signer]) {
revert SignerNotPresent();
}
delete ERC1155SeaDropContractOffererStorage
.layout()
._allowedSigners[signer];
_asAddressArray(_removeFromEnumeration)(signer, enumeratedStorage);
}
// Emit an event with the update.
emit SignerUpdated(signer, allowed);
}
/**
* @notice Updates the allowed payer and emits an event.
*
* @param payer The payer to add or remove.
* @param allowed Whether to add or remove the payer.
*/
function updatePayer(address payer, bool allowed) external {
// Ensure this contract is only called into with delegatecall.
_onlyDelegateCalled();
if (payer == address(0)) {
revert PayerCannotBeZeroAddress();
}
// Track the enumerated storage.
address[]
storage enumeratedStorage = ERC1155SeaDropContractOffererStorage
.layout()
._enumeratedPayers;
mapping(address => bool)
storage payersMap = ERC1155SeaDropContractOffererStorage
.layout()
._allowedPayers;
if (allowed) {
if (payersMap[payer]) {
revert DuplicatePayer();
}
payersMap[payer] = true;
enumeratedStorage.push(payer);
} else {
if (!payersMap[payer]) {
revert PayerNotPresent();
}
delete ERC1155SeaDropContractOffererStorage.layout()._allowedPayers[
payer
];
_asAddressArray(_removeFromEnumeration)(payer, enumeratedStorage);
}
// Emit an event with the update.
emit PayerUpdated(payer, allowed);
}
/**
* @notice Verify an EIP-712 signature by recreating the data structure
* that we signed on the client side, and then using that to recover
* the address that signed the signature for this data.
*
* @param minter The mint recipient.
* @param feeRecipient The fee recipient.
* @param mintParams The mint params.
* @param salt The salt for the signed mint.
*/
function _getDigest(
address minter,
address feeRecipient,
MintParams memory mintParams,
uint256 salt
) internal view returns (bytes32 digest) {
// Put mintParams back on the stack to avoid stack too deep.
MintParams memory mintParams_ = mintParams;
bytes32 mintParamsHashStruct = keccak256(
abi.encode(
_MINT_PARAMS_TYPEHASH,
mintParams_.startPrice,
mintParams_.endPrice,
mintParams_.startTime,
mintParams_.endTime,
mintParams_.paymentToken,
mintParams_.fromTokenId,
mintParams_.toTokenId,
mintParams_.maxTotalMintableByWallet,
mintParams_.maxTotalMintableByWalletPerToken,
mintParams_.maxTokenSupplyForStage,
mintParams_.dropStageIndex,
mintParams_.feeBps,
mintParams_.restrictFeeRecipients
)
);
digest = keccak256(
bytes.concat(
bytes2(0x1901),
_deriveDomainSeparator(),
keccak256(
abi.encode(
_SIGNED_MINT_TYPEHASH,
minter,
feeRecipient,
mintParamsHashStruct,
salt
)
)
)
);
}
/**
* @notice Internal utility function to remove a uint256 from a supplied
* enumeration.
*
* @param toRemove The uint256 to remove.
* @param enumeration The enumerated uint256s to parse.
*/
function _removeFromEnumeration(
uint256 toRemove,
uint256[] storage enumeration
) internal {
// Cache the length.
uint256 enumerationLength = enumeration.length;
for (uint256 i = 0; i < enumerationLength; ) {
// Check if the enumerated element is the one we are deleting.
if (enumeration[i] == toRemove) {
// Swap with the last element.
enumeration[i] = enumeration[enumerationLength - 1];
// Delete the (now duplicated) last element.
enumeration.pop();
// Exit the loop.
break;
}
unchecked {
++i;
}
}
}
/**
* @notice Internal utility function to cast uint types to address
* to dedupe the need for multiple implementations of
* `_removeFromEnumeration`.
*
* @param fnIn The fn with uint input.
*
* @return fnOut The fn with address input.
*/
function _asAddressArray(
function(uint256, uint256[] storage) internal fnIn
)
internal
pure
returns (function(address, address[] storage) internal fnOut)
{
assembly {
fnOut := fnIn
}
}
/**
* @dev Returns whether `leaf` exists in the Merkle tree with `root`,
* given `proof`.
*
* Original function from solady called `verifyCalldata`, modified
* to use an offset from the context calldata to avoid expanding
* memory.
*/
function _verifyProof(
bytes calldata context,
uint256 proofOffsetInContext,
bytes32 root,
bytes32 leaf
) internal pure returns (bool isValid) {
/// @solidity memory-safe-assembly
assembly {
if sub(context.length, proofOffsetInContext) {
// Initialize `offset` to the offset of `proof` in the calldata.
let offset := add(context.offset, proofOffsetInContext)
let end := add(
offset,
sub(context.length, proofOffsetInContext)
)
// Iterate over proof elements to compute root hash.
// prettier-ignore
for {} 1 {} {
// Slot of `leaf` in scratch space.
// If the condition is true: 0x20, otherwise: 0x00.
let scratch := shl(5, gt(leaf, calldataload(offset)))
// Store elements to hash contiguously in scratch space.
// Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
mstore(scratch, leaf)
mstore(xor(scratch, 0x20), calldataload(offset))
// Reuse `leaf` to store the hash to reduce stack operations.
leaf := keccak256(0x00, 0x40)
offset := add(offset, 0x20)
if iszero(lt(offset, end)) {
break
}
}
}
isValid := eq(leaf, root)
}
}
/**
* @dev Internal view function to revert if this implementation contract is
* called without delegatecall.
*/
function _onlyDelegateCalled() internal view {
if (address(this) == _originalImplementation) {
revert OnlyDelegateCalled();
}
}
/**
* @dev Internal pure function to revert with a provided reason.
* If no reason is provided, reverts with no message.
*/
function _revertWithReason(bytes memory data) internal pure {
// Bubble up the revert reason.
assembly {
revert(add(32, data), mload(data))
}
}
/**
* @dev Internal pure function to cast a `bool` value to a `uint256` value,
* then invert to match Unix style where 0 signifies success.
*
* @param b The `bool` value to cast.
*
* @return u The `uint256` value.
*/
function _castAndInvert(bool b) internal pure returns (uint256 u) {
assembly {
u := iszero(b)
}
}
/**
* @dev Internal pure function to cast a `bool` value to a `uint256` value.
*
* @param b The `bool` value to cast.
*
* @return u The `uint256` value.
*/
function _cast(bool b) internal pure returns (uint256 u) {
assembly {
u := b
}
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import { PublicDrop } from "./ERC1155SeaDropStructs.sol";
import { CreatorPayout } from "./SeaDropStructs.sol";
library ERC1155SeaDropContractOffererStorage {
struct Layout {
/// @notice The allowed Seaport addresses that can mint.
mapping(address => bool) _allowedSeaport;
/// @notice The enumerated allowed Seaport addresses.
address[] _enumeratedAllowedSeaport;
/// @notice The public drop data.
mapping(uint256 => PublicDrop) _publicDrops;
/// @notice The enumerated public drop indexes.
uint256[] _enumeratedPublicDropIndexes;
/// @notice The creator payout addresses and basis points.
CreatorPayout[] _creatorPayouts;
/// @notice The allow list merkle root.
bytes32 _allowListMerkleRoot;
/// @notice The allowed fee recipients.
mapping(address => bool) _allowedFeeRecipients;
/// @notice The enumerated allowed fee recipients.
address[] _enumeratedFeeRecipients;
/// @notice The allowed server-side signers.
mapping(address => bool) _allowedSigners;
/// @notice The enumerated allowed signers.
address[] _enumeratedSigners;
/// @notice The used signature digests.
mapping(bytes32 => bool) _usedDigests;
/// @notice The allowed payers.
mapping(address => bool) _allowedPayers;
/// @notice The enumerated allowed payers.
address[] _enumeratedPayers;
}
bytes32 internal constant STORAGE_SLOT =
bytes32(
uint256(
keccak256("contracts.storage.ERC1155SeaDropContractOfferer")
) - 1
);
function layout() internal pure returns (Layout storage l) {
bytes32 slot = STORAGE_SLOT;
assembly {
l.slot := slot
}
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import { PublicDrop } from "./ERC1155SeaDropStructs.sol";
import { SeaDropErrorsAndEvents } from "./SeaDropErrorsAndEvents.sol";
interface ERC1155SeaDropErrorsAndEvents is SeaDropErrorsAndEvents {
/**
* @dev Revert with an error if an empty PublicDrop is provided
* for an already-empty public drop.
*/
error PublicDropStageNotPresent();
/**
* @dev Revert with an error if the mint quantity exceeds the
* max minted per wallet for a certain token id.
*/
error MintQuantityExceedsMaxMintedPerWalletForTokenId(
uint256 tokenId,
uint256 total,
uint256 allowed
);
/**
* @dev Revert with an error if the target token id to mint is not within
* the drop stage range.
*/
error TokenIdNotWithinDropStageRange(
uint256 tokenId,
uint256 startTokenId,
uint256 endTokenId
);
/**
* @notice Revert with an error if the number of maxSupplyAmounts doesn't
* match the number of maxSupplyTokenIds.
*/
error MaxSupplyMismatch();
/**
* @notice Revert with an error if the number of mint tokenIds doesn't
* match the number of mint amounts.
*/
error MintAmountsMismatch();
/**
* @notice Revert with an error if the mint order offer contains
* a duplicate tokenId.
*/
error OfferContainsDuplicateTokenId(uint256 tokenId);
/**
* @dev Revert if the fromTokenId is greater than the toTokenId.
*/
error InvalidFromAndToTokenId(uint256 fromTokenId, uint256 toTokenId);
/**
* @notice Revert with an error if the number of publicDropIndexes doesn't
* match the number of publicDrops.
*/
error PublicDropsMismatch();
/**
* @dev An event with updated public drop data.
*/
event PublicDropUpdated(PublicDrop publicDrop, uint256 index);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import { AllowListData, CreatorPayout } from "./SeaDropStructs.sol";
/**
* @notice A struct defining public drop data.
* Designed to fit efficiently in two storage slots.
*
* @param startPrice The start price per token. (Up to 1.2m
* of native token, e.g. ETH, MATIC)
* @param endPrice The end price per token. If this differs
* from startPrice, the current price will
* be calculated based on the current time.
* @param startTime The start time, ensure this is not zero.
* @param endTime The end time, ensure this is not zero.
* @param restrictFeeRecipients If false, allow any fee recipient;
* if true, check fee recipient is allowed.
* @param paymentToken The payment token address. Null for
* native token.
* @param fromTokenId The start token id for the stage.
* @param toTokenId The end token id for the stage.
* @param maxTotalMintableByWallet Maximum total number of mints a user is
* allowed. (The limit for this field is
* 2^16 - 1)
* @param maxTotalMintableByWalletPerToken Maximum total number of mints a user
* is allowed for the token id. (The limit for
* this field is 2^16 - 1)
* @param feeBps Fee out of 10_000 basis points to be
* collected.
*/
struct PublicDrop {
// slot 1
uint80 startPrice; // 80/512 bits
uint80 endPrice; // 160/512 bits
uint40 startTime; // 200/512 bits
uint40 endTime; // 240/512 bits
bool restrictFeeRecipients; // 248/512 bits
// uint8 unused;
// slot 2
address paymentToken; // 408/512 bits
uint24 fromTokenId; // 432/512 bits
uint24 toTokenId; // 456/512 bits
uint16 maxTotalMintableByWallet; // 472/512 bits
uint16 maxTotalMintableByWalletPerToken; // 488/512 bits
uint16 feeBps; // 504/512 bits
}
/**
* @notice A struct defining mint params for an allow list.
* An allow list leaf will be composed of `msg.sender` and
* the following params.
*
* Note: Since feeBps is encoded in the leaf, backend should ensure
* that feeBps is acceptable before generating a proof.
*
* @param startPrice The start price per token. (Up to 1.2m
* of native token, e.g. ETH, MATIC)
* @param endPrice The end price per token. If this differs
* from startPrice, the current price will
* be calculated based on the current time.
* @param startTime The start time, ensure this is not zero.
* @param endTime The end time, ensure this is not zero.
* @param paymentToken The payment token for the mint. Null for
* native token.
* @param fromTokenId The start token id for the stage.
* @param toTokenId The end token id for the stage.
* @param maxTotalMintableByWallet Maximum total number of mints a user is
* allowed.
* @param maxTotalMintableByWalletPerToken Maximum total number of mints a user
* is allowed for the token id.
* @param maxTokenSupplyForStage The limit of token supply this stage can
* mint within.
* @param dropStageIndex The drop stage index to emit with the event
* for analytical purposes. This should be
* non-zero since the public mint emits with
* index zero.
* @param feeBps Fee out of 10_000 basis points to be
* collected.
* @param restrictFeeRecipients If false, allow any fee recipient;
* if true, check fee recipient is allowed.
*/
struct MintParams {
uint256 startPrice;
uint256 endPrice;
uint256 startTime;
uint256 endTime;
address paymentToken;
uint256 fromTokenId;
uint256 toTokenId;
uint256 maxTotalMintableByWallet;
uint256 maxTotalMintableByWalletPerToken;
uint256 maxTokenSupplyForStage;
uint256 dropStageIndex; // non-zero
uint256 feeBps;
bool restrictFeeRecipients;
}
/**
* @dev Struct containing internal SeaDrop implementation logic
* mint details to avoid stack too deep.
*
* @param feeRecipient The fee recipient.
* @param payer The payer of the mint.
* @param minter The mint recipient.
* @param tokenIds The tokenIds to mint.
* @param quantities The number of tokens to mint per tokenId.
* @param withEffects Whether to apply state changes of the mint.
*/
struct MintDetails {
address feeRecipient;
address payer;
address minter;
uint256[] tokenIds;
uint256[] quantities;
bool withEffects;
}
/**
* @notice A struct to configure multiple contract options in one transaction.
*/
struct MultiConfigureStruct {
uint256[] maxSupplyTokenIds;
uint256[] maxSupplyAmounts;
string baseURI;
string contractURI;
PublicDrop[] publicDrops;
uint256[] publicDropsIndexes;
string dropURI;
AllowListData allowListData;
CreatorPayout[] creatorPayouts;
bytes32 provenanceHash;
address[] allowedFeeRecipients;
address[] disallowedFeeRecipients;
address[] allowedPayers;
address[] disallowedPayers;
// Server-signed
address[] allowedSigners;
address[] disallowedSigners;
// ERC-2981
address royaltyReceiver;
uint96 royaltyBps;
// Mint
address mintRecipient;
uint256[] mintTokenIds;
uint256[] mintAmounts;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import { AllowListData, CreatorPayout } from "./SeaDropStructs.sol";
/**
* @notice A struct defining public drop data.
* Designed to fit efficiently in two storage slots.
*
* @param startPrice The start price per token. (Up to 1.2m
* of native token, e.g. ETH, MATIC)
* @param endPrice The end price per token. If this differs
* from startPrice, the current price will
* be calculated based on the current time.
* @param startTime The start time, ensure this is not zero.
* @param endTime The end time, ensure this is not zero.
* @param paymentToken The payment token address. Null for
* native token.
* @param maxTotalMintableByWallet Maximum total number of mints a user is
* allowed. (The limit for this field is
* 2^16 - 1)
* @param feeBps Fee out of 10_000 basis points to be
* collected.
* @param restrictFeeRecipients If false, allow any fee recipient;
* if true, check fee recipient is allowed.
*/
struct PublicDrop {
uint80 startPrice; // 80/512 bits
uint80 endPrice; // 160/512 bits
uint40 startTime; // 200/512 bits
uint40 endTime; // 240/512 bits
address paymentToken; // 400/512 bits
uint16 maxTotalMintableByWallet; // 416/512 bits
uint16 feeBps; // 432/512 bits
bool restrictFeeRecipients; // 440/512 bits
}
/**
* @notice A struct defining mint params for an allow list.
* An allow list leaf will be composed of `msg.sender` and
* the following params.
*
* Note: Since feeBps is encoded in the leaf, backend should ensure
* that feeBps is acceptable before generating a proof.
*
* @param startPrice The start price per token. (Up to 1.2m
* of native token, e.g. ETH, MATIC)
* @param endPrice The end price per token. If this differs
* from startPrice, the current price will
* be calculated based on the current time.
* @param startTime The start time, ensure this is not zero.
* @param endTime The end time, ensure this is not zero.
* @param paymentToken The payment token for the mint. Null for
* native token.
* @param maxTotalMintableByWallet Maximum total number of mints a user is
* allowed.
* @param maxTokenSupplyForStage The limit of token supply this stage can
* mint within.
* @param dropStageIndex The drop stage index to emit with the event
* for analytical purposes. This should be
* non-zero since the public mint emits with
* index zero.
* @param feeBps Fee out of 10_000 basis points to be
* collected.
* @param restrictFeeRecipients If false, allow any fee recipient;
* if true, check fee recipient is allowed.
*/
struct MintParams {
uint256 startPrice;
uint256 endPrice;
uint256 startTime;
uint256 endTime;
address paymentToken;
uint256 maxTotalMintableByWallet;
uint256 maxTokenSupplyForStage;
uint256 dropStageIndex; // non-zero
uint256 feeBps;
bool restrictFeeRecipients;
}
/**
* @dev Struct containing internal SeaDrop implementation logic
* mint details to avoid stack too deep.
*
* @param feeRecipient The fee recipient.
* @param payer The payer of the mint.
* @param minter The mint recipient.
* @param quantity The number of tokens to mint.
* @param withEffects Whether to apply state changes of the mint.
*/
struct MintDetails {
address feeRecipient;
address payer;
address minter;
uint256 quantity;
bool withEffects;
}
/**
* @notice A struct to configure multiple contract options in one transaction.
*/
struct MultiConfigureStruct {
uint256 maxSupply;
string baseURI;
string contractURI;
PublicDrop publicDrop;
string dropURI;
AllowListData allowListData;
CreatorPayout[] creatorPayouts;
bytes32 provenanceHash;
address[] allowedFeeRecipients;
address[] disallowedFeeRecipients;
address[] allowedPayers;
address[] disallowedPayers;
// Server-signed
address[] allowedSigners;
address[] disallowedSigners;
// ERC-2981
address royaltyReceiver;
uint96 royaltyBps;
// Mint
address mintRecipient;
uint256 mintQuantity;
}
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.17;
/**
* @title An immutable registry contract to be deployed as a standalone primitive
* @dev See EIP-5639, new project launches can read previous cold wallet -> hot wallet delegations
* from here and integrate those permissions into their flow
*/
interface IDelegationRegistry {
/// @notice Delegation type
enum DelegationType {
NONE,
ALL,
CONTRACT,
TOKEN
}
/// @notice Info about a single delegation, used for onchain enumeration
struct DelegationInfo {
DelegationType type_;
address vault;
address delegate;
address contract_;
uint256 tokenId;
}
/// @notice Info about a single contract-level delegation
struct ContractDelegation {
address contract_;
address delegate;
}
/// @notice Info about a single token-level delegation
struct TokenDelegation {
address contract_;
uint256 tokenId;
address delegate;
}
/// @notice Emitted when a user delegates their entire wallet
event DelegateForAll(
address indexed vault,
address indexed delegate,
bool value
);
/// @notice Emitted when a user delegates a specific contract
event DelegateForContract(
address indexed vault,
address indexed delegate,
address indexed contract_,
bool value
);
/// @notice Emitted when a user delegates a specific token
event DelegateForToken(
address indexed vault,
address indexed delegate,
address indexed contract_,
uint256 tokenId,
bool value
);
/// @notice Emitted when a user revokes all delegations
event RevokeAllDelegates(address indexed vault);
/// @notice Emitted when a user revoes all delegations for a given delegate
event RevokeDelegate(address indexed vault, address indexed delegate);
/**
* ----------- WRITE -----------
*/
/**
* @notice Allow the delegate to act on your behalf for all contracts
* @param delegate The hotwallet to act on your behalf
* @param value Whether to enable or disable delegation for this address, true for setting and false for revoking
*/
function delegateForAll(address delegate, bool value) external;
/**
* @notice Allow the delegate to act on your behalf for a specific contract
* @param delegate The hotwallet to act on your behalf
* @param contract_ The address for the contract you're delegating
* @param value Whether to enable or disable delegation for this address, true for setting and false for revoking
*/
function delegateForContract(
address delegate,
address contract_,
bool value
) external;
/**
* @notice Allow the delegate to act on your behalf for a specific token
* @param delegate The hotwallet to act on your behalf
* @param contract_ The address for the contract you're delegating
* @param tokenId The token id for the token you're delegating
* @param value Whether to enable or disable delegation for this address, true for setting and false for revoking
*/
function delegateForToken(
address delegate,
address contract_,
uint256 tokenId,
bool value
) external;
/**
* @notice Revoke all delegates
*/
function revokeAllDelegates() external;
/**
* @notice Revoke a specific delegate for all their permissions
* @param delegate The hotwallet to revoke
*/
function revokeDelegate(address delegate) external;
/**
* @notice Remove yourself as a delegate for a specific vault
* @param vault The vault which delegated to the msg.sender, and should be removed
*/
function revokeSelf(address vault) external;
/**
* ----------- READ -----------
*/
/**
* @notice Returns all active delegations a given delegate is able to claim on behalf of
* @param delegate The delegate that you would like to retrieve delegations for
* @return info Array of DelegationInfo structs
*/
function getDelegationsByDelegate(
address delegate
) external view returns (DelegationInfo[] memory);
/**
* @notice Returns an array of wallet-level delegates for a given vault
* @param vault The cold wallet who issued the delegation
* @return addresses Array of wallet-level delegates for a given vault
*/
function getDelegatesForAll(
address vault
) external view returns (address[] memory);
/**
* @notice Returns an array of contract-level delegates for a given vault and contract
* @param vault The cold wallet who issued the delegation
* @param contract_ The address for the contract you're delegating
* @return addresses Array of contract-level delegates for a given vault and contract
*/
function getDelegatesForContract(
address vault,
address contract_
) external view returns (address[] memory);
/**
* @notice Returns an array of contract-level delegates for a given vault's token
* @param vault The cold wallet who issued the delegation
* @param contract_ The address for the contract holding the token
* @param tokenId The token id for the token you're delegating
* @return addresses Array of contract-level delegates for a given vault's token
*/
function getDelegatesForToken(
address vault,
address contract_,
uint256 tokenId
) external view returns (address[] memory);
/**
* @notice Returns all contract-level delegations for a given vault
* @param vault The cold wallet who issued the delegations
* @return delegations Array of ContractDelegation structs
*/
function getContractLevelDelegations(
address vault
) external view returns (ContractDelegation[] memory delegations);
/**
* @notice Returns all token-level delegations for a given vault
* @param vault The cold wallet who issued the delegations
* @return delegations Array of TokenDelegation structs
*/
function getTokenLevelDelegations(
address vault
) external view returns (TokenDelegation[] memory delegations);
/**
* @notice Returns true if the address is delegated to act on the entire vault
* @param delegate The hotwallet to act on your behalf
* @param vault The cold wallet who issued the delegation
*/
function checkDelegateForAll(
address delegate,
address vault
) external view returns (bool);
/**
* @notice Returns true if the address is delegated to act on your behalf for a token contract or an entire vault
* @param delegate The hotwallet to act on your behalf
* @param contract_ The address for the contract you're delegating
* @param vault The cold wallet who issued the delegation
*/
function checkDelegateForContract(
address delegate,
address vault,
address contract_
) external view returns (bool);
/**
* @notice Returns true if the address is delegated to act on your behalf for a specific token, the token's contract or an entire vault
* @param delegate The hotwallet to act on your behalf
* @param contract_ The address for the contract you're delegating
* @param tokenId The token id for the token you're delegating
* @param vault The cold wallet who issued the delegation
*/
function checkDelegateForToken(
address delegate,
address vault,
address contract_,
uint256 tokenId
) external view returns (bool);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {
ISeaDropTokenContractMetadata
} from "./ISeaDropTokenContractMetadata.sol";
interface IERC1155ContractMetadata is ISeaDropTokenContractMetadata {
/**
* @dev A struct representing the supply info for a token id,
* packed into one storage slot.
*
* @param maxSupply The max supply for the token id.
* @param totalSupply The total token supply for the token id.
* Subtracted when an item is burned.
* @param totalMinted The total number of tokens minted for the token id.
*/
struct TokenSupply {
uint64 maxSupply; // 64/256 bits
uint64 totalSupply; // 128/256 bits
uint64 totalMinted; // 192/256 bits
}
/**
* @dev Emit an event when the max token supply for a token id is updated.
*/
event MaxSupplyUpdated(uint256 tokenId, uint256 newMaxSupply);
/**
* @dev Revert with an error if the mint quantity exceeds the max token
* supply.
*/
error MintExceedsMaxSupply(uint256 total, uint256 maxSupply);
/**
* @notice Sets the max supply for a token id and emits an event.
*
* @param tokenId The token id to set the max supply for.
* @param newMaxSupply The new max supply to set.
*/
function setMaxSupply(uint256 tokenId, uint256 newMaxSupply) external;
/**
* @notice Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @notice Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @notice Returns the max token supply for a token id.
*/
function maxSupply(uint256 tokenId) external view returns (uint256);
/**
* @notice Returns the total supply for a token id.
*/
function totalSupply(uint256 tokenId) external view returns (uint256);
/**
* @notice Returns the total minted for a token id.
*/
function totalMinted(uint256 tokenId) external view returns (uint256);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import { ISeaDropToken } from "./ISeaDropToken.sol";
import { PublicDrop } from "../lib/ERC1155SeaDropStructs.sol";
/**
* @dev A helper interface to get and set parameters for ERC1155SeaDrop.
* The token does not expose these methods as part of its external
* interface to optimize contract size, but does implement them.
*/
interface IERC1155SeaDrop is ISeaDropToken {
/**
* @notice Update the SeaDrop public drop parameters at a given index.
*
* @param publicDrop The new public drop parameters.
* @param index The public drop index.
*/
function updatePublicDrop(
PublicDrop calldata publicDrop,
uint256 index
) external;
/**
* @notice Returns the public drop stage parameters at a given index.
*
* @param index The index of the public drop stage.
*/
function getPublicDrop(
uint256 index
) external view returns (PublicDrop memory);
/**
* @notice Returns the public drop indexes.
*/
function getPublicDropIndexes() external view returns (uint256[] memory);
/**
* @notice Returns a set of mint stats for the address.
* This assists SeaDrop in enforcing maxSupply,
* maxTotalMintableByWallet, maxTotalMintableByWalletPerToken,
* and maxTokenSupplyForStage checks.
*
* @dev NOTE: Implementing contracts should always update these numbers
* before transferring any tokens with _safeMint() to mitigate
* consequences of malicious onERC1155Received() hooks.
*
* @param minter The minter address.
* @param tokenId The token id to return stats for.
*/
function getMintStats(
address minter,
uint256 tokenId
)
external
view
returns (
uint256 minterNumMinted,
uint256 minterNumMintedForTokenId,
uint256 totalMintedForTokenId,
uint256 maxSupply
);
/**
* @notice This function is only allowed to be called by the configurer
* contract as a way to batch mints and configuration in one tx.
*
* @param recipient The address to receive the mints.
* @param tokenIds The tokenIds to mint.
* @param amounts The amounts to mint.
*/
function multiConfigureMint(
address recipient,
uint256[] calldata tokenIds,
uint256[] calldata amounts
) external;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
interface IERC173 {
/// @notice Returns the address of the owner.
function owner() external view returns (address);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {
ISeaDropTokenContractMetadata
} from "./ISeaDropTokenContractMetadata.sol";
import { AllowListData, CreatorPayout } from "../lib/SeaDropStructs.sol";
/**
* @dev A helper base interface for IERC721SeaDrop and IERC1155SeaDrop.
* The token does not expose these methods as part of its external
* interface to optimize contract size, but does implement them.
*/
interface ISeaDropToken is ISeaDropTokenContractMetadata {
/**
* @notice Update the SeaDrop allowed Seaport contracts privileged to mint.
* Only the owner can use this function.
*
* @param allowedSeaport The allowed Seaport addresses.
*/
function updateAllowedSeaport(address[] calldata allowedSeaport) external;
/**
* @notice Update the SeaDrop allowed fee recipient.
* Only the owner can use this function.
*
* @param feeRecipient The new fee recipient.
* @param allowed Whether the fee recipient is allowed.
*/
function updateAllowedFeeRecipient(
address feeRecipient,
bool allowed
) external;
/**
* @notice Update the SeaDrop creator payout addresses.
* The total basis points must add up to exactly 10_000.
* Only the owner can use this function.
*
* @param creatorPayouts The new creator payouts.
*/
function updateCreatorPayouts(
CreatorPayout[] calldata creatorPayouts
) external;
/**
* @notice Update the SeaDrop drop URI.
* Only the owner can use this function.
*
* @param dropURI The new drop URI.
*/
function updateDropURI(string calldata dropURI) external;
/**
* @notice Update the SeaDrop allow list data.
* Only the owner can use this function.
*
* @param allowListData The new allow list data.
*/
function updateAllowList(AllowListData calldata allowListData) external;
/**
* @notice Update the SeaDrop allowed payers.
* Only the owner can use this function.
*
* @param payer The payer to update.
* @param allowed Whether the payer is allowed.
*/
function updatePayer(address payer, bool allowed) external;
/**
* @notice Update the SeaDrop allowed signer.
* Only the owner can use this function.
* An allowed signer can also disallow themselves.
*
* @param signer The signer to update.
* @param allowed Whether the signer is allowed.
*/
function updateSigner(address signer, bool allowed) external;
/**
* @notice Get the SeaDrop allowed Seaport contracts privileged to mint.
*/
function getAllowedSeaport() external view returns (address[] memory);
/**
* @notice Returns the SeaDrop creator payouts.
*/
function getCreatorPayouts() external view returns (CreatorPayout[] memory);
/**
* @notice Returns the SeaDrop allow list merkle root.
*/
function getAllowListMerkleRoot() external view returns (bytes32);
/**
* @notice Returns the SeaDrop allowed fee recipients.
*/
function getAllowedFeeRecipients() external view returns (address[] memory);
/**
* @notice Returns the SeaDrop allowed signers.
*/
function getSigners() external view returns (address[] memory);
/**
* @notice Returns if the signed digest has been used.
*
* @param digest The digest hash.
*/
function getDigestIsUsed(bytes32 digest) external view returns (bool);
/**
* @notice Returns the SeaDrop allowed payers.
*/
function getPayers() external view returns (address[] memory);
/**
* @notice Returns the configurer contract.
*/
function configurer() external view returns (address);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
interface ISeaDropTokenContractMetadata {
/**
* @dev Emit an event for token metadata reveals/updates,
* according to EIP-4906.
*
* @param _fromTokenId The start token id.
* @param _toTokenId The end token id.
*/
event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId);
/**
* @dev Emit an event when the URI for the collection-level metadata
* is updated.
*/
event ContractURIUpdated(string newContractURI);
/**
* @dev Emit an event with the previous and new provenance hash after
* being updated.
*/
event ProvenanceHashUpdated(bytes32 previousHash, bytes32 newHash);
/**
* @dev Emit an event when the EIP-2981 royalty info is updated.
*/
event RoyaltyInfoUpdated(address receiver, uint256 basisPoints);
/**
* @notice Throw if the max supply exceeds uint64, a limit
* due to the storage of bit-packed variables.
*/
error CannotExceedMaxSupplyOfUint64(uint256 got);
/**
* @dev Revert with an error when attempting to set the provenance
* hash after the mint has started.
*/
error ProvenanceHashCannotBeSetAfterMintStarted();
/**
* @dev Revert with an error when attempting to set the provenance
* hash after it has already been set.
*/
error ProvenanceHashCannotBeSetAfterAlreadyBeingSet();
/**
* @notice Sets the base URI for the token metadata and emits an event.
*
* @param tokenURI The new base URI to set.
*/
function setBaseURI(string calldata tokenURI) external;
/**
* @notice Sets the contract URI for contract metadata.
*
* @param newContractURI The new contract URI.
*/
function setContractURI(string calldata newContractURI) external;
/**
* @notice Sets the provenance hash and emits an event.
*
* The provenance hash is used for random reveals, which
* is a hash of the ordered metadata to show it has not been
* modified after mint started.
*
* This function will revert after the first item has been minted.
*
* @param newProvenanceHash The new provenance hash to set.
*/
function setProvenanceHash(bytes32 newProvenanceHash) external;
/**
* @notice Sets the default royalty information.
*
* Requirements:
*
* - `receiver` cannot be the zero address.
* - `feeNumerator` cannot be greater than the fee denominator of
* 10_000 basis points.
*/
function setDefaultRoyalty(address receiver, uint96 feeNumerator) external;
/**
* @notice Returns the base URI for token metadata.
*/
function baseURI() external view returns (string memory);
/**
* @notice Returns the contract URI.
*/
function contractURI() external view returns (string memory);
/**
* @notice Returns the provenance hash.
* The provenance hash is used for random reveals, which
* is a hash of the ordered metadata to show it is unmodified
* after mint has started.
*/
function provenanceHash() external view returns (bytes32);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
type CalldataPointer is uint256;
type ReturndataPointer is uint256;
type MemoryPointer is uint256;
using CalldataPointerLib for CalldataPointer global;
using MemoryPointerLib for MemoryPointer global;
using ReturndataPointerLib for ReturndataPointer global;
using CalldataReaders for CalldataPointer global;
using ReturndataReaders for ReturndataPointer global;
using MemoryReaders for MemoryPointer global;
using MemoryWriters for MemoryPointer global;
CalldataPointer constant CalldataStart = CalldataPointer.wrap(0x04);
MemoryPointer constant FreeMemoryPPtr = MemoryPointer.wrap(0x40);
uint256 constant IdentityPrecompileAddress = 0x4;
uint256 constant OffsetOrLengthMask = 0xffffffff;
uint256 constant _OneWord = 0x20;
uint256 constant _FreeMemoryPointerSlot = 0x40;
/// @dev Allocates `size` bytes in memory by increasing the free memory pointer
/// and returns the memory pointer to the first byte of the allocated region.
// (Free functions cannot have visibility.)
// solhint-disable-next-line func-visibility
function malloc(uint256 size) pure returns (MemoryPointer mPtr) {
assembly {
mPtr := mload(_FreeMemoryPointerSlot)
mstore(_FreeMemoryPointerSlot, add(mPtr, size))
}
}
// (Free functions cannot have visibility.)
// solhint-disable-next-line func-visibility
function getFreeMemoryPointer() pure returns (MemoryPointer mPtr) {
mPtr = FreeMemoryPPtr.readMemoryPointer();
}
// (Free functions cannot have visibility.)
// solhint-disable-next-line func-visibility
function setFreeMemoryPointer(MemoryPointer mPtr) pure {
FreeMemoryPPtr.write(mPtr);
}
library CalldataPointerLib {
function lt(
CalldataPointer a,
CalldataPointer b
) internal pure returns (bool c) {
assembly {
c := lt(a, b)
}
}
function gt(
CalldataPointer a,
CalldataPointer b
) internal pure returns (bool c) {
assembly {
c := gt(a, b)
}
}
function eq(
CalldataPointer a,
CalldataPointer b
) internal pure returns (bool c) {
assembly {
c := eq(a, b)
}
}
function isNull(CalldataPointer a) internal pure returns (bool b) {
assembly {
b := iszero(a)
}
}
/// @dev Resolves an offset stored at `cdPtr + headOffset` to a calldata.
/// pointer `cdPtr` must point to some parent object with a dynamic
/// type's head stored at `cdPtr + headOffset`.
function pptr(
CalldataPointer cdPtr,
uint256 headOffset
) internal pure returns (CalldataPointer cdPtrChild) {
cdPtrChild = cdPtr.offset(
cdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask
);
}
/// @dev Resolves an offset stored at `cdPtr` to a calldata pointer.
/// `cdPtr` must point to some parent object with a dynamic type as its
/// first member, e.g. `struct { bytes data; }`
function pptr(
CalldataPointer cdPtr
) internal pure returns (CalldataPointer cdPtrChild) {
cdPtrChild = cdPtr.offset(cdPtr.readUint256() & OffsetOrLengthMask);
}
/// @dev Returns the calldata pointer one word after `cdPtr`.
function next(
CalldataPointer cdPtr
) internal pure returns (CalldataPointer cdPtrNext) {
assembly {
cdPtrNext := add(cdPtr, _OneWord)
}
}
/// @dev Returns the calldata pointer `_offset` bytes after `cdPtr`.
function offset(
CalldataPointer cdPtr,
uint256 _offset
) internal pure returns (CalldataPointer cdPtrNext) {
assembly {
cdPtrNext := add(cdPtr, _offset)
}
}
/// @dev Copies `size` bytes from calldata starting at `src` to memory at
/// `dst`.
function copy(
CalldataPointer src,
MemoryPointer dst,
uint256 size
) internal pure {
assembly {
calldatacopy(dst, src, size)
}
}
}
library ReturndataPointerLib {
function lt(
ReturndataPointer a,
ReturndataPointer b
) internal pure returns (bool c) {
assembly {
c := lt(a, b)
}
}
function gt(
ReturndataPointer a,
ReturndataPointer b
) internal pure returns (bool c) {
assembly {
c := gt(a, b)
}
}
function eq(
ReturndataPointer a,
ReturndataPointer b
) internal pure returns (bool c) {
assembly {
c := eq(a, b)
}
}
function isNull(ReturndataPointer a) internal pure returns (bool b) {
assembly {
b := iszero(a)
}
}
/// @dev Resolves an offset stored at `rdPtr + headOffset` to a returndata
/// pointer. `rdPtr` must point to some parent object with a dynamic
/// type's head stored at `rdPtr + headOffset`.
function pptr(
ReturndataPointer rdPtr,
uint256 headOffset
) internal pure returns (ReturndataPointer rdPtrChild) {
rdPtrChild = rdPtr.offset(
rdPtr.offset(headOffset).readUint256() & OffsetOrLengthMask
);
}
/// @dev Resolves an offset stored at `rdPtr` to a returndata pointer.
/// `rdPtr` must point to some parent object with a dynamic type as its
/// first member, e.g. `struct { bytes data; }`
function pptr(
ReturndataPointer rdPtr
) internal pure returns (ReturndataPointer rdPtrChild) {
rdPtrChild = rdPtr.offset(rdPtr.readUint256() & OffsetOrLengthMask);
}
/// @dev Returns the returndata pointer one word after `cdPtr`.
function next(
ReturndataPointer rdPtr
) internal pure returns (ReturndataPointer rdPtrNext) {
assembly {
rdPtrNext := add(rdPtr, _OneWord)
}
}
/// @dev Returns the returndata pointer `_offset` bytes after `cdPtr`.
function offset(
ReturndataPointer rdPtr,
uint256 _offset
) internal pure returns (ReturndataPointer rdPtrNext) {
assembly {
rdPtrNext := add(rdPtr, _offset)
}
}
/// @dev Copies `size` bytes from returndata starting at `src` to memory at
/// `dst`.
function copy(
ReturndataPointer src,
MemoryPointer dst,
uint256 size
) internal pure {
assembly {
returndatacopy(dst, src, size)
}
}
}
library MemoryPointerLib {
function copy(
MemoryPointer src,
MemoryPointer dst,
uint256 size
) internal view {
assembly {
let success := staticcall(
gas(),
IdentityPrecompileAddress,
src,
size,
dst,
size
)
if or(iszero(returndatasize()), iszero(success)) {
revert(0, 0)
}
}
}
function lt(
MemoryPointer a,
MemoryPointer b
) internal pure returns (bool c) {
assembly {
c := lt(a, b)
}
}
function gt(
MemoryPointer a,
MemoryPointer b
) internal pure returns (bool c) {
assembly {
c := gt(a, b)
}
}
function eq(
MemoryPointer a,
MemoryPointer b
) internal pure returns (bool c) {
assembly {
c := eq(a, b)
}
}
function isNull(MemoryPointer a) internal pure returns (bool b) {
assembly {
b := iszero(a)
}
}
function hash(
MemoryPointer ptr,
uint256 length
) internal pure returns (bytes32 _hash) {
assembly {
_hash := keccak256(ptr, length)
}
}
/// @dev Returns the memory pointer one word after `mPtr`.
function next(
MemoryPointer mPtr
) internal pure returns (MemoryPointer mPtrNext) {
assembly {
mPtrNext := add(mPtr, _OneWord)
}
}
/// @dev Returns the memory pointer `_offset` bytes after `mPtr`.
function offset(
MemoryPointer mPtr,
uint256 _offset
) internal pure returns (MemoryPointer mPtrNext) {
assembly {
mPtrNext := add(mPtr, _offset)
}
}
/// @dev Resolves a pointer at `mPtr + headOffset` to a memory
/// pointer. `mPtr` must point to some parent object with a dynamic
/// type's pointer stored at `mPtr + headOffset`.
function pptr(
MemoryPointer mPtr,
uint256 headOffset
) internal pure returns (MemoryPointer mPtrChild) {
mPtrChild = mPtr.offset(headOffset).readMemoryPointer();
}
/// @dev Resolves a pointer stored at `mPtr` to a memory pointer.
/// `mPtr` must point to some parent object with a dynamic type as its
/// first member, e.g. `struct { bytes data; }`
function pptr(
MemoryPointer mPtr
) internal pure returns (MemoryPointer mPtrChild) {
mPtrChild = mPtr.readMemoryPointer();
}
}
library CalldataReaders {
/// @dev Reads the value at `cdPtr` and applies a mask to return only the
/// last 4 bytes.
function readMaskedUint256(
CalldataPointer cdPtr
) internal pure returns (uint256 value) {
value = cdPtr.readUint256() & OffsetOrLengthMask;
}
/// @dev Reads the bool at `cdPtr` in calldata.
function readBool(
CalldataPointer cdPtr
) internal pure returns (bool value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the address at `cdPtr` in calldata.
function readAddress(
CalldataPointer cdPtr
) internal pure returns (address value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes1 at `cdPtr` in calldata.
function readBytes1(
CalldataPointer cdPtr
) internal pure returns (bytes1 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes2 at `cdPtr` in calldata.
function readBytes2(
CalldataPointer cdPtr
) internal pure returns (bytes2 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes3 at `cdPtr` in calldata.
function readBytes3(
CalldataPointer cdPtr
) internal pure returns (bytes3 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes4 at `cdPtr` in calldata.
function readBytes4(
CalldataPointer cdPtr
) internal pure returns (bytes4 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes5 at `cdPtr` in calldata.
function readBytes5(
CalldataPointer cdPtr
) internal pure returns (bytes5 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes6 at `cdPtr` in calldata.
function readBytes6(
CalldataPointer cdPtr
) internal pure returns (bytes6 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes7 at `cdPtr` in calldata.
function readBytes7(
CalldataPointer cdPtr
) internal pure returns (bytes7 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes8 at `cdPtr` in calldata.
function readBytes8(
CalldataPointer cdPtr
) internal pure returns (bytes8 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes9 at `cdPtr` in calldata.
function readBytes9(
CalldataPointer cdPtr
) internal pure returns (bytes9 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes10 at `cdPtr` in calldata.
function readBytes10(
CalldataPointer cdPtr
) internal pure returns (bytes10 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes11 at `cdPtr` in calldata.
function readBytes11(
CalldataPointer cdPtr
) internal pure returns (bytes11 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes12 at `cdPtr` in calldata.
function readBytes12(
CalldataPointer cdPtr
) internal pure returns (bytes12 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes13 at `cdPtr` in calldata.
function readBytes13(
CalldataPointer cdPtr
) internal pure returns (bytes13 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes14 at `cdPtr` in calldata.
function readBytes14(
CalldataPointer cdPtr
) internal pure returns (bytes14 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes15 at `cdPtr` in calldata.
function readBytes15(
CalldataPointer cdPtr
) internal pure returns (bytes15 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes16 at `cdPtr` in calldata.
function readBytes16(
CalldataPointer cdPtr
) internal pure returns (bytes16 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes17 at `cdPtr` in calldata.
function readBytes17(
CalldataPointer cdPtr
) internal pure returns (bytes17 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes18 at `cdPtr` in calldata.
function readBytes18(
CalldataPointer cdPtr
) internal pure returns (bytes18 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes19 at `cdPtr` in calldata.
function readBytes19(
CalldataPointer cdPtr
) internal pure returns (bytes19 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes20 at `cdPtr` in calldata.
function readBytes20(
CalldataPointer cdPtr
) internal pure returns (bytes20 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes21 at `cdPtr` in calldata.
function readBytes21(
CalldataPointer cdPtr
) internal pure returns (bytes21 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes22 at `cdPtr` in calldata.
function readBytes22(
CalldataPointer cdPtr
) internal pure returns (bytes22 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes23 at `cdPtr` in calldata.
function readBytes23(
CalldataPointer cdPtr
) internal pure returns (bytes23 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes24 at `cdPtr` in calldata.
function readBytes24(
CalldataPointer cdPtr
) internal pure returns (bytes24 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes25 at `cdPtr` in calldata.
function readBytes25(
CalldataPointer cdPtr
) internal pure returns (bytes25 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes26 at `cdPtr` in calldata.
function readBytes26(
CalldataPointer cdPtr
) internal pure returns (bytes26 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes27 at `cdPtr` in calldata.
function readBytes27(
CalldataPointer cdPtr
) internal pure returns (bytes27 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes28 at `cdPtr` in calldata.
function readBytes28(
CalldataPointer cdPtr
) internal pure returns (bytes28 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes29 at `cdPtr` in calldata.
function readBytes29(
CalldataPointer cdPtr
) internal pure returns (bytes29 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes30 at `cdPtr` in calldata.
function readBytes30(
CalldataPointer cdPtr
) internal pure returns (bytes30 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes31 at `cdPtr` in calldata.
function readBytes31(
CalldataPointer cdPtr
) internal pure returns (bytes31 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the bytes32 at `cdPtr` in calldata.
function readBytes32(
CalldataPointer cdPtr
) internal pure returns (bytes32 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint8 at `cdPtr` in calldata.
function readUint8(
CalldataPointer cdPtr
) internal pure returns (uint8 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint16 at `cdPtr` in calldata.
function readUint16(
CalldataPointer cdPtr
) internal pure returns (uint16 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint24 at `cdPtr` in calldata.
function readUint24(
CalldataPointer cdPtr
) internal pure returns (uint24 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint32 at `cdPtr` in calldata.
function readUint32(
CalldataPointer cdPtr
) internal pure returns (uint32 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint40 at `cdPtr` in calldata.
function readUint40(
CalldataPointer cdPtr
) internal pure returns (uint40 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint48 at `cdPtr` in calldata.
function readUint48(
CalldataPointer cdPtr
) internal pure returns (uint48 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint56 at `cdPtr` in calldata.
function readUint56(
CalldataPointer cdPtr
) internal pure returns (uint56 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint64 at `cdPtr` in calldata.
function readUint64(
CalldataPointer cdPtr
) internal pure returns (uint64 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint72 at `cdPtr` in calldata.
function readUint72(
CalldataPointer cdPtr
) internal pure returns (uint72 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint80 at `cdPtr` in calldata.
function readUint80(
CalldataPointer cdPtr
) internal pure returns (uint80 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint88 at `cdPtr` in calldata.
function readUint88(
CalldataPointer cdPtr
) internal pure returns (uint88 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint96 at `cdPtr` in calldata.
function readUint96(
CalldataPointer cdPtr
) internal pure returns (uint96 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint104 at `cdPtr` in calldata.
function readUint104(
CalldataPointer cdPtr
) internal pure returns (uint104 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint112 at `cdPtr` in calldata.
function readUint112(
CalldataPointer cdPtr
) internal pure returns (uint112 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint120 at `cdPtr` in calldata.
function readUint120(
CalldataPointer cdPtr
) internal pure returns (uint120 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint128 at `cdPtr` in calldata.
function readUint128(
CalldataPointer cdPtr
) internal pure returns (uint128 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint136 at `cdPtr` in calldata.
function readUint136(
CalldataPointer cdPtr
) internal pure returns (uint136 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint144 at `cdPtr` in calldata.
function readUint144(
CalldataPointer cdPtr
) internal pure returns (uint144 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint152 at `cdPtr` in calldata.
function readUint152(
CalldataPointer cdPtr
) internal pure returns (uint152 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint160 at `cdPtr` in calldata.
function readUint160(
CalldataPointer cdPtr
) internal pure returns (uint160 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint168 at `cdPtr` in calldata.
function readUint168(
CalldataPointer cdPtr
) internal pure returns (uint168 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint176 at `cdPtr` in calldata.
function readUint176(
CalldataPointer cdPtr
) internal pure returns (uint176 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint184 at `cdPtr` in calldata.
function readUint184(
CalldataPointer cdPtr
) internal pure returns (uint184 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint192 at `cdPtr` in calldata.
function readUint192(
CalldataPointer cdPtr
) internal pure returns (uint192 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint200 at `cdPtr` in calldata.
function readUint200(
CalldataPointer cdPtr
) internal pure returns (uint200 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint208 at `cdPtr` in calldata.
function readUint208(
CalldataPointer cdPtr
) internal pure returns (uint208 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint216 at `cdPtr` in calldata.
function readUint216(
CalldataPointer cdPtr
) internal pure returns (uint216 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint224 at `cdPtr` in calldata.
function readUint224(
CalldataPointer cdPtr
) internal pure returns (uint224 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint232 at `cdPtr` in calldata.
function readUint232(
CalldataPointer cdPtr
) internal pure returns (uint232 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint240 at `cdPtr` in calldata.
function readUint240(
CalldataPointer cdPtr
) internal pure returns (uint240 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint248 at `cdPtr` in calldata.
function readUint248(
CalldataPointer cdPtr
) internal pure returns (uint248 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the uint256 at `cdPtr` in calldata.
function readUint256(
CalldataPointer cdPtr
) internal pure returns (uint256 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int8 at `cdPtr` in calldata.
function readInt8(
CalldataPointer cdPtr
) internal pure returns (int8 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int16 at `cdPtr` in calldata.
function readInt16(
CalldataPointer cdPtr
) internal pure returns (int16 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int24 at `cdPtr` in calldata.
function readInt24(
CalldataPointer cdPtr
) internal pure returns (int24 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int32 at `cdPtr` in calldata.
function readInt32(
CalldataPointer cdPtr
) internal pure returns (int32 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int40 at `cdPtr` in calldata.
function readInt40(
CalldataPointer cdPtr
) internal pure returns (int40 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int48 at `cdPtr` in calldata.
function readInt48(
CalldataPointer cdPtr
) internal pure returns (int48 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int56 at `cdPtr` in calldata.
function readInt56(
CalldataPointer cdPtr
) internal pure returns (int56 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int64 at `cdPtr` in calldata.
function readInt64(
CalldataPointer cdPtr
) internal pure returns (int64 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int72 at `cdPtr` in calldata.
function readInt72(
CalldataPointer cdPtr
) internal pure returns (int72 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int80 at `cdPtr` in calldata.
function readInt80(
CalldataPointer cdPtr
) internal pure returns (int80 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int88 at `cdPtr` in calldata.
function readInt88(
CalldataPointer cdPtr
) internal pure returns (int88 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int96 at `cdPtr` in calldata.
function readInt96(
CalldataPointer cdPtr
) internal pure returns (int96 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int104 at `cdPtr` in calldata.
function readInt104(
CalldataPointer cdPtr
) internal pure returns (int104 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int112 at `cdPtr` in calldata.
function readInt112(
CalldataPointer cdPtr
) internal pure returns (int112 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int120 at `cdPtr` in calldata.
function readInt120(
CalldataPointer cdPtr
) internal pure returns (int120 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int128 at `cdPtr` in calldata.
function readInt128(
CalldataPointer cdPtr
) internal pure returns (int128 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int136 at `cdPtr` in calldata.
function readInt136(
CalldataPointer cdPtr
) internal pure returns (int136 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int144 at `cdPtr` in calldata.
function readInt144(
CalldataPointer cdPtr
) internal pure returns (int144 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int152 at `cdPtr` in calldata.
function readInt152(
CalldataPointer cdPtr
) internal pure returns (int152 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int160 at `cdPtr` in calldata.
function readInt160(
CalldataPointer cdPtr
) internal pure returns (int160 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int168 at `cdPtr` in calldata.
function readInt168(
CalldataPointer cdPtr
) internal pure returns (int168 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int176 at `cdPtr` in calldata.
function readInt176(
CalldataPointer cdPtr
) internal pure returns (int176 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int184 at `cdPtr` in calldata.
function readInt184(
CalldataPointer cdPtr
) internal pure returns (int184 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int192 at `cdPtr` in calldata.
function readInt192(
CalldataPointer cdPtr
) internal pure returns (int192 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int200 at `cdPtr` in calldata.
function readInt200(
CalldataPointer cdPtr
) internal pure returns (int200 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int208 at `cdPtr` in calldata.
function readInt208(
CalldataPointer cdPtr
) internal pure returns (int208 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int216 at `cdPtr` in calldata.
function readInt216(
CalldataPointer cdPtr
) internal pure returns (int216 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int224 at `cdPtr` in calldata.
function readInt224(
CalldataPointer cdPtr
) internal pure returns (int224 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int232 at `cdPtr` in calldata.
function readInt232(
CalldataPointer cdPtr
) internal pure returns (int232 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int240 at `cdPtr` in calldata.
function readInt240(
CalldataPointer cdPtr
) internal pure returns (int240 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int248 at `cdPtr` in calldata.
function readInt248(
CalldataPointer cdPtr
) internal pure returns (int248 value) {
assembly {
value := calldataload(cdPtr)
}
}
/// @dev Reads the int256 at `cdPtr` in calldata.
function readInt256(
CalldataPointer cdPtr
) internal pure returns (int256 value) {
assembly {
value := calldataload(cdPtr)
}
}
}
library ReturndataReaders {
/// @dev Reads value at `rdPtr` & applies a mask to return only last 4 bytes
function readMaskedUint256(
ReturndataPointer rdPtr
) internal pure returns (uint256 value) {
value = rdPtr.readUint256() & OffsetOrLengthMask;
}
/// @dev Reads the bool at `rdPtr` in returndata.
function readBool(
ReturndataPointer rdPtr
) internal pure returns (bool value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the address at `rdPtr` in returndata.
function readAddress(
ReturndataPointer rdPtr
) internal pure returns (address value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes1 at `rdPtr` in returndata.
function readBytes1(
ReturndataPointer rdPtr
) internal pure returns (bytes1 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes2 at `rdPtr` in returndata.
function readBytes2(
ReturndataPointer rdPtr
) internal pure returns (bytes2 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes3 at `rdPtr` in returndata.
function readBytes3(
ReturndataPointer rdPtr
) internal pure returns (bytes3 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes4 at `rdPtr` in returndata.
function readBytes4(
ReturndataPointer rdPtr
) internal pure returns (bytes4 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes5 at `rdPtr` in returndata.
function readBytes5(
ReturndataPointer rdPtr
) internal pure returns (bytes5 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes6 at `rdPtr` in returndata.
function readBytes6(
ReturndataPointer rdPtr
) internal pure returns (bytes6 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes7 at `rdPtr` in returndata.
function readBytes7(
ReturndataPointer rdPtr
) internal pure returns (bytes7 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes8 at `rdPtr` in returndata.
function readBytes8(
ReturndataPointer rdPtr
) internal pure returns (bytes8 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes9 at `rdPtr` in returndata.
function readBytes9(
ReturndataPointer rdPtr
) internal pure returns (bytes9 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes10 at `rdPtr` in returndata.
function readBytes10(
ReturndataPointer rdPtr
) internal pure returns (bytes10 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes11 at `rdPtr` in returndata.
function readBytes11(
ReturndataPointer rdPtr
) internal pure returns (bytes11 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes12 at `rdPtr` in returndata.
function readBytes12(
ReturndataPointer rdPtr
) internal pure returns (bytes12 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes13 at `rdPtr` in returndata.
function readBytes13(
ReturndataPointer rdPtr
) internal pure returns (bytes13 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes14 at `rdPtr` in returndata.
function readBytes14(
ReturndataPointer rdPtr
) internal pure returns (bytes14 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes15 at `rdPtr` in returndata.
function readBytes15(
ReturndataPointer rdPtr
) internal pure returns (bytes15 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes16 at `rdPtr` in returndata.
function readBytes16(
ReturndataPointer rdPtr
) internal pure returns (bytes16 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes17 at `rdPtr` in returndata.
function readBytes17(
ReturndataPointer rdPtr
) internal pure returns (bytes17 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes18 at `rdPtr` in returndata.
function readBytes18(
ReturndataPointer rdPtr
) internal pure returns (bytes18 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes19 at `rdPtr` in returndata.
function readBytes19(
ReturndataPointer rdPtr
) internal pure returns (bytes19 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes20 at `rdPtr` in returndata.
function readBytes20(
ReturndataPointer rdPtr
) internal pure returns (bytes20 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes21 at `rdPtr` in returndata.
function readBytes21(
ReturndataPointer rdPtr
) internal pure returns (bytes21 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes22 at `rdPtr` in returndata.
function readBytes22(
ReturndataPointer rdPtr
) internal pure returns (bytes22 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes23 at `rdPtr` in returndata.
function readBytes23(
ReturndataPointer rdPtr
) internal pure returns (bytes23 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes24 at `rdPtr` in returndata.
function readBytes24(
ReturndataPointer rdPtr
) internal pure returns (bytes24 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes25 at `rdPtr` in returndata.
function readBytes25(
ReturndataPointer rdPtr
) internal pure returns (bytes25 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes26 at `rdPtr` in returndata.
function readBytes26(
ReturndataPointer rdPtr
) internal pure returns (bytes26 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes27 at `rdPtr` in returndata.
function readBytes27(
ReturndataPointer rdPtr
) internal pure returns (bytes27 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes28 at `rdPtr` in returndata.
function readBytes28(
ReturndataPointer rdPtr
) internal pure returns (bytes28 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes29 at `rdPtr` in returndata.
function readBytes29(
ReturndataPointer rdPtr
) internal pure returns (bytes29 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes30 at `rdPtr` in returndata.
function readBytes30(
ReturndataPointer rdPtr
) internal pure returns (bytes30 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes31 at `rdPtr` in returndata.
function readBytes31(
ReturndataPointer rdPtr
) internal pure returns (bytes31 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the bytes32 at `rdPtr` in returndata.
function readBytes32(
ReturndataPointer rdPtr
) internal pure returns (bytes32 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint8 at `rdPtr` in returndata.
function readUint8(
ReturndataPointer rdPtr
) internal pure returns (uint8 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint16 at `rdPtr` in returndata.
function readUint16(
ReturndataPointer rdPtr
) internal pure returns (uint16 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint24 at `rdPtr` in returndata.
function readUint24(
ReturndataPointer rdPtr
) internal pure returns (uint24 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint32 at `rdPtr` in returndata.
function readUint32(
ReturndataPointer rdPtr
) internal pure returns (uint32 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint40 at `rdPtr` in returndata.
function readUint40(
ReturndataPointer rdPtr
) internal pure returns (uint40 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint48 at `rdPtr` in returndata.
function readUint48(
ReturndataPointer rdPtr
) internal pure returns (uint48 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint56 at `rdPtr` in returndata.
function readUint56(
ReturndataPointer rdPtr
) internal pure returns (uint56 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint64 at `rdPtr` in returndata.
function readUint64(
ReturndataPointer rdPtr
) internal pure returns (uint64 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint72 at `rdPtr` in returndata.
function readUint72(
ReturndataPointer rdPtr
) internal pure returns (uint72 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint80 at `rdPtr` in returndata.
function readUint80(
ReturndataPointer rdPtr
) internal pure returns (uint80 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint88 at `rdPtr` in returndata.
function readUint88(
ReturndataPointer rdPtr
) internal pure returns (uint88 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint96 at `rdPtr` in returndata.
function readUint96(
ReturndataPointer rdPtr
) internal pure returns (uint96 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint104 at `rdPtr` in returndata.
function readUint104(
ReturndataPointer rdPtr
) internal pure returns (uint104 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint112 at `rdPtr` in returndata.
function readUint112(
ReturndataPointer rdPtr
) internal pure returns (uint112 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint120 at `rdPtr` in returndata.
function readUint120(
ReturndataPointer rdPtr
) internal pure returns (uint120 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint128 at `rdPtr` in returndata.
function readUint128(
ReturndataPointer rdPtr
) internal pure returns (uint128 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint136 at `rdPtr` in returndata.
function readUint136(
ReturndataPointer rdPtr
) internal pure returns (uint136 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint144 at `rdPtr` in returndata.
function readUint144(
ReturndataPointer rdPtr
) internal pure returns (uint144 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint152 at `rdPtr` in returndata.
function readUint152(
ReturndataPointer rdPtr
) internal pure returns (uint152 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint160 at `rdPtr` in returndata.
function readUint160(
ReturndataPointer rdPtr
) internal pure returns (uint160 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint168 at `rdPtr` in returndata.
function readUint168(
ReturndataPointer rdPtr
) internal pure returns (uint168 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint176 at `rdPtr` in returndata.
function readUint176(
ReturndataPointer rdPtr
) internal pure returns (uint176 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint184 at `rdPtr` in returndata.
function readUint184(
ReturndataPointer rdPtr
) internal pure returns (uint184 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint192 at `rdPtr` in returndata.
function readUint192(
ReturndataPointer rdPtr
) internal pure returns (uint192 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint200 at `rdPtr` in returndata.
function readUint200(
ReturndataPointer rdPtr
) internal pure returns (uint200 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint208 at `rdPtr` in returndata.
function readUint208(
ReturndataPointer rdPtr
) internal pure returns (uint208 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint216 at `rdPtr` in returndata.
function readUint216(
ReturndataPointer rdPtr
) internal pure returns (uint216 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint224 at `rdPtr` in returndata.
function readUint224(
ReturndataPointer rdPtr
) internal pure returns (uint224 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint232 at `rdPtr` in returndata.
function readUint232(
ReturndataPointer rdPtr
) internal pure returns (uint232 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint240 at `rdPtr` in returndata.
function readUint240(
ReturndataPointer rdPtr
) internal pure returns (uint240 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint248 at `rdPtr` in returndata.
function readUint248(
ReturndataPointer rdPtr
) internal pure returns (uint248 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the uint256 at `rdPtr` in returndata.
function readUint256(
ReturndataPointer rdPtr
) internal pure returns (uint256 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int8 at `rdPtr` in returndata.
function readInt8(
ReturndataPointer rdPtr
) internal pure returns (int8 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int16 at `rdPtr` in returndata.
function readInt16(
ReturndataPointer rdPtr
) internal pure returns (int16 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int24 at `rdPtr` in returndata.
function readInt24(
ReturndataPointer rdPtr
) internal pure returns (int24 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int32 at `rdPtr` in returndata.
function readInt32(
ReturndataPointer rdPtr
) internal pure returns (int32 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int40 at `rdPtr` in returndata.
function readInt40(
ReturndataPointer rdPtr
) internal pure returns (int40 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int48 at `rdPtr` in returndata.
function readInt48(
ReturndataPointer rdPtr
) internal pure returns (int48 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int56 at `rdPtr` in returndata.
function readInt56(
ReturndataPointer rdPtr
) internal pure returns (int56 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int64 at `rdPtr` in returndata.
function readInt64(
ReturndataPointer rdPtr
) internal pure returns (int64 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int72 at `rdPtr` in returndata.
function readInt72(
ReturndataPointer rdPtr
) internal pure returns (int72 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int80 at `rdPtr` in returndata.
function readInt80(
ReturndataPointer rdPtr
) internal pure returns (int80 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int88 at `rdPtr` in returndata.
function readInt88(
ReturndataPointer rdPtr
) internal pure returns (int88 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int96 at `rdPtr` in returndata.
function readInt96(
ReturndataPointer rdPtr
) internal pure returns (int96 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int104 at `rdPtr` in returndata.
function readInt104(
ReturndataPointer rdPtr
) internal pure returns (int104 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int112 at `rdPtr` in returndata.
function readInt112(
ReturndataPointer rdPtr
) internal pure returns (int112 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int120 at `rdPtr` in returndata.
function readInt120(
ReturndataPointer rdPtr
) internal pure returns (int120 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int128 at `rdPtr` in returndata.
function readInt128(
ReturndataPointer rdPtr
) internal pure returns (int128 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int136 at `rdPtr` in returndata.
function readInt136(
ReturndataPointer rdPtr
) internal pure returns (int136 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int144 at `rdPtr` in returndata.
function readInt144(
ReturndataPointer rdPtr
) internal pure returns (int144 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int152 at `rdPtr` in returndata.
function readInt152(
ReturndataPointer rdPtr
) internal pure returns (int152 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int160 at `rdPtr` in returndata.
function readInt160(
ReturndataPointer rdPtr
) internal pure returns (int160 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int168 at `rdPtr` in returndata.
function readInt168(
ReturndataPointer rdPtr
) internal pure returns (int168 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int176 at `rdPtr` in returndata.
function readInt176(
ReturndataPointer rdPtr
) internal pure returns (int176 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int184 at `rdPtr` in returndata.
function readInt184(
ReturndataPointer rdPtr
) internal pure returns (int184 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int192 at `rdPtr` in returndata.
function readInt192(
ReturndataPointer rdPtr
) internal pure returns (int192 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int200 at `rdPtr` in returndata.
function readInt200(
ReturndataPointer rdPtr
) internal pure returns (int200 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int208 at `rdPtr` in returndata.
function readInt208(
ReturndataPointer rdPtr
) internal pure returns (int208 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int216 at `rdPtr` in returndata.
function readInt216(
ReturndataPointer rdPtr
) internal pure returns (int216 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int224 at `rdPtr` in returndata.
function readInt224(
ReturndataPointer rdPtr
) internal pure returns (int224 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int232 at `rdPtr` in returndata.
function readInt232(
ReturndataPointer rdPtr
) internal pure returns (int232 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int240 at `rdPtr` in returndata.
function readInt240(
ReturndataPointer rdPtr
) internal pure returns (int240 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int248 at `rdPtr` in returndata.
function readInt248(
ReturndataPointer rdPtr
) internal pure returns (int248 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
/// @dev Reads the int256 at `rdPtr` in returndata.
function readInt256(
ReturndataPointer rdPtr
) internal pure returns (int256 value) {
assembly {
returndatacopy(0, rdPtr, _OneWord)
value := mload(0)
}
}
}
library MemoryReaders {
/// @dev Reads the memory pointer at `mPtr` in memory.
function readMemoryPointer(
MemoryPointer mPtr
) internal pure returns (MemoryPointer value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads value at `mPtr` & applies a mask to return only last 4 bytes
function readMaskedUint256(
MemoryPointer mPtr
) internal pure returns (uint256 value) {
value = mPtr.readUint256() & OffsetOrLengthMask;
}
/// @dev Reads the bool at `mPtr` in memory.
function readBool(MemoryPointer mPtr) internal pure returns (bool value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the address at `mPtr` in memory.
function readAddress(
MemoryPointer mPtr
) internal pure returns (address value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes1 at `mPtr` in memory.
function readBytes1(
MemoryPointer mPtr
) internal pure returns (bytes1 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes2 at `mPtr` in memory.
function readBytes2(
MemoryPointer mPtr
) internal pure returns (bytes2 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes3 at `mPtr` in memory.
function readBytes3(
MemoryPointer mPtr
) internal pure returns (bytes3 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes4 at `mPtr` in memory.
function readBytes4(
MemoryPointer mPtr
) internal pure returns (bytes4 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes5 at `mPtr` in memory.
function readBytes5(
MemoryPointer mPtr
) internal pure returns (bytes5 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes6 at `mPtr` in memory.
function readBytes6(
MemoryPointer mPtr
) internal pure returns (bytes6 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes7 at `mPtr` in memory.
function readBytes7(
MemoryPointer mPtr
) internal pure returns (bytes7 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes8 at `mPtr` in memory.
function readBytes8(
MemoryPointer mPtr
) internal pure returns (bytes8 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes9 at `mPtr` in memory.
function readBytes9(
MemoryPointer mPtr
) internal pure returns (bytes9 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes10 at `mPtr` in memory.
function readBytes10(
MemoryPointer mPtr
) internal pure returns (bytes10 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes11 at `mPtr` in memory.
function readBytes11(
MemoryPointer mPtr
) internal pure returns (bytes11 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes12 at `mPtr` in memory.
function readBytes12(
MemoryPointer mPtr
) internal pure returns (bytes12 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes13 at `mPtr` in memory.
function readBytes13(
MemoryPointer mPtr
) internal pure returns (bytes13 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes14 at `mPtr` in memory.
function readBytes14(
MemoryPointer mPtr
) internal pure returns (bytes14 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes15 at `mPtr` in memory.
function readBytes15(
MemoryPointer mPtr
) internal pure returns (bytes15 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes16 at `mPtr` in memory.
function readBytes16(
MemoryPointer mPtr
) internal pure returns (bytes16 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes17 at `mPtr` in memory.
function readBytes17(
MemoryPointer mPtr
) internal pure returns (bytes17 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes18 at `mPtr` in memory.
function readBytes18(
MemoryPointer mPtr
) internal pure returns (bytes18 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes19 at `mPtr` in memory.
function readBytes19(
MemoryPointer mPtr
) internal pure returns (bytes19 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes20 at `mPtr` in memory.
function readBytes20(
MemoryPointer mPtr
) internal pure returns (bytes20 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes21 at `mPtr` in memory.
function readBytes21(
MemoryPointer mPtr
) internal pure returns (bytes21 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes22 at `mPtr` in memory.
function readBytes22(
MemoryPointer mPtr
) internal pure returns (bytes22 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes23 at `mPtr` in memory.
function readBytes23(
MemoryPointer mPtr
) internal pure returns (bytes23 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes24 at `mPtr` in memory.
function readBytes24(
MemoryPointer mPtr
) internal pure returns (bytes24 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes25 at `mPtr` in memory.
function readBytes25(
MemoryPointer mPtr
) internal pure returns (bytes25 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes26 at `mPtr` in memory.
function readBytes26(
MemoryPointer mPtr
) internal pure returns (bytes26 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes27 at `mPtr` in memory.
function readBytes27(
MemoryPointer mPtr
) internal pure returns (bytes27 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes28 at `mPtr` in memory.
function readBytes28(
MemoryPointer mPtr
) internal pure returns (bytes28 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes29 at `mPtr` in memory.
function readBytes29(
MemoryPointer mPtr
) internal pure returns (bytes29 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes30 at `mPtr` in memory.
function readBytes30(
MemoryPointer mPtr
) internal pure returns (bytes30 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes31 at `mPtr` in memory.
function readBytes31(
MemoryPointer mPtr
) internal pure returns (bytes31 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the bytes32 at `mPtr` in memory.
function readBytes32(
MemoryPointer mPtr
) internal pure returns (bytes32 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint8 at `mPtr` in memory.
function readUint8(MemoryPointer mPtr) internal pure returns (uint8 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint16 at `mPtr` in memory.
function readUint16(
MemoryPointer mPtr
) internal pure returns (uint16 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint24 at `mPtr` in memory.
function readUint24(
MemoryPointer mPtr
) internal pure returns (uint24 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint32 at `mPtr` in memory.
function readUint32(
MemoryPointer mPtr
) internal pure returns (uint32 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint40 at `mPtr` in memory.
function readUint40(
MemoryPointer mPtr
) internal pure returns (uint40 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint48 at `mPtr` in memory.
function readUint48(
MemoryPointer mPtr
) internal pure returns (uint48 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint56 at `mPtr` in memory.
function readUint56(
MemoryPointer mPtr
) internal pure returns (uint56 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint64 at `mPtr` in memory.
function readUint64(
MemoryPointer mPtr
) internal pure returns (uint64 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint72 at `mPtr` in memory.
function readUint72(
MemoryPointer mPtr
) internal pure returns (uint72 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint80 at `mPtr` in memory.
function readUint80(
MemoryPointer mPtr
) internal pure returns (uint80 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint88 at `mPtr` in memory.
function readUint88(
MemoryPointer mPtr
) internal pure returns (uint88 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint96 at `mPtr` in memory.
function readUint96(
MemoryPointer mPtr
) internal pure returns (uint96 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint104 at `mPtr` in memory.
function readUint104(
MemoryPointer mPtr
) internal pure returns (uint104 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint112 at `mPtr` in memory.
function readUint112(
MemoryPointer mPtr
) internal pure returns (uint112 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint120 at `mPtr` in memory.
function readUint120(
MemoryPointer mPtr
) internal pure returns (uint120 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint128 at `mPtr` in memory.
function readUint128(
MemoryPointer mPtr
) internal pure returns (uint128 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint136 at `mPtr` in memory.
function readUint136(
MemoryPointer mPtr
) internal pure returns (uint136 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint144 at `mPtr` in memory.
function readUint144(
MemoryPointer mPtr
) internal pure returns (uint144 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint152 at `mPtr` in memory.
function readUint152(
MemoryPointer mPtr
) internal pure returns (uint152 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint160 at `mPtr` in memory.
function readUint160(
MemoryPointer mPtr
) internal pure returns (uint160 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint168 at `mPtr` in memory.
function readUint168(
MemoryPointer mPtr
) internal pure returns (uint168 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint176 at `mPtr` in memory.
function readUint176(
MemoryPointer mPtr
) internal pure returns (uint176 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint184 at `mPtr` in memory.
function readUint184(
MemoryPointer mPtr
) internal pure returns (uint184 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint192 at `mPtr` in memory.
function readUint192(
MemoryPointer mPtr
) internal pure returns (uint192 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint200 at `mPtr` in memory.
function readUint200(
MemoryPointer mPtr
) internal pure returns (uint200 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint208 at `mPtr` in memory.
function readUint208(
MemoryPointer mPtr
) internal pure returns (uint208 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint216 at `mPtr` in memory.
function readUint216(
MemoryPointer mPtr
) internal pure returns (uint216 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint224 at `mPtr` in memory.
function readUint224(
MemoryPointer mPtr
) internal pure returns (uint224 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint232 at `mPtr` in memory.
function readUint232(
MemoryPointer mPtr
) internal pure returns (uint232 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint240 at `mPtr` in memory.
function readUint240(
MemoryPointer mPtr
) internal pure returns (uint240 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint248 at `mPtr` in memory.
function readUint248(
MemoryPointer mPtr
) internal pure returns (uint248 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the uint256 at `mPtr` in memory.
function readUint256(
MemoryPointer mPtr
) internal pure returns (uint256 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int8 at `mPtr` in memory.
function readInt8(MemoryPointer mPtr) internal pure returns (int8 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int16 at `mPtr` in memory.
function readInt16(MemoryPointer mPtr) internal pure returns (int16 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int24 at `mPtr` in memory.
function readInt24(MemoryPointer mPtr) internal pure returns (int24 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int32 at `mPtr` in memory.
function readInt32(MemoryPointer mPtr) internal pure returns (int32 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int40 at `mPtr` in memory.
function readInt40(MemoryPointer mPtr) internal pure returns (int40 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int48 at `mPtr` in memory.
function readInt48(MemoryPointer mPtr) internal pure returns (int48 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int56 at `mPtr` in memory.
function readInt56(MemoryPointer mPtr) internal pure returns (int56 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int64 at `mPtr` in memory.
function readInt64(MemoryPointer mPtr) internal pure returns (int64 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int72 at `mPtr` in memory.
function readInt72(MemoryPointer mPtr) internal pure returns (int72 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int80 at `mPtr` in memory.
function readInt80(MemoryPointer mPtr) internal pure returns (int80 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int88 at `mPtr` in memory.
function readInt88(MemoryPointer mPtr) internal pure returns (int88 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int96 at `mPtr` in memory.
function readInt96(MemoryPointer mPtr) internal pure returns (int96 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int104 at `mPtr` in memory.
function readInt104(
MemoryPointer mPtr
) internal pure returns (int104 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int112 at `mPtr` in memory.
function readInt112(
MemoryPointer mPtr
) internal pure returns (int112 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int120 at `mPtr` in memory.
function readInt120(
MemoryPointer mPtr
) internal pure returns (int120 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int128 at `mPtr` in memory.
function readInt128(
MemoryPointer mPtr
) internal pure returns (int128 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int136 at `mPtr` in memory.
function readInt136(
MemoryPointer mPtr
) internal pure returns (int136 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int144 at `mPtr` in memory.
function readInt144(
MemoryPointer mPtr
) internal pure returns (int144 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int152 at `mPtr` in memory.
function readInt152(
MemoryPointer mPtr
) internal pure returns (int152 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int160 at `mPtr` in memory.
function readInt160(
MemoryPointer mPtr
) internal pure returns (int160 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int168 at `mPtr` in memory.
function readInt168(
MemoryPointer mPtr
) internal pure returns (int168 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int176 at `mPtr` in memory.
function readInt176(
MemoryPointer mPtr
) internal pure returns (int176 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int184 at `mPtr` in memory.
function readInt184(
MemoryPointer mPtr
) internal pure returns (int184 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int192 at `mPtr` in memory.
function readInt192(
MemoryPointer mPtr
) internal pure returns (int192 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int200 at `mPtr` in memory.
function readInt200(
MemoryPointer mPtr
) internal pure returns (int200 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int208 at `mPtr` in memory.
function readInt208(
MemoryPointer mPtr
) internal pure returns (int208 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int216 at `mPtr` in memory.
function readInt216(
MemoryPointer mPtr
) internal pure returns (int216 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int224 at `mPtr` in memory.
function readInt224(
MemoryPointer mPtr
) internal pure returns (int224 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int232 at `mPtr` in memory.
function readInt232(
MemoryPointer mPtr
) internal pure returns (int232 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int240 at `mPtr` in memory.
function readInt240(
MemoryPointer mPtr
) internal pure returns (int240 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int248 at `mPtr` in memory.
function readInt248(
MemoryPointer mPtr
) internal pure returns (int248 value) {
assembly {
value := mload(mPtr)
}
}
/// @dev Reads the int256 at `mPtr` in memory.
function readInt256(
MemoryPointer mPtr
) internal pure returns (int256 value) {
assembly {
value := mload(mPtr)
}
}
}
library MemoryWriters {
/// @dev Writes `valuePtr` to memory at `mPtr`.
function write(MemoryPointer mPtr, MemoryPointer valuePtr) internal pure {
assembly {
mstore(mPtr, valuePtr)
}
}
/// @dev Writes a boolean `value` to `mPtr` in memory.
function write(MemoryPointer mPtr, bool value) internal pure {
assembly {
mstore(mPtr, value)
}
}
/// @dev Writes an address `value` to `mPtr` in memory.
function write(MemoryPointer mPtr, address value) internal pure {
assembly {
mstore(mPtr, value)
}
}
/// @dev Writes a bytes32 `value` to `mPtr` in memory.
/// Separate name to disambiguate literal write parameters.
function writeBytes32(MemoryPointer mPtr, bytes32 value) internal pure {
assembly {
mstore(mPtr, value)
}
}
/// @dev Writes a uint256 `value` to `mPtr` in memory.
function write(MemoryPointer mPtr, uint256 value) internal pure {
assembly {
mstore(mPtr, value)
}
}
/// @dev Writes an int256 `value` to `mPtr` in memory.
/// Separate name to disambiguate literal write parameters.
function writeInt(MemoryPointer mPtr, int256 value) internal pure {
assembly {
mstore(mPtr, value)
}
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import { CreatorPayout, PublicDrop } from "./ERC721SeaDropStructs.sol";
interface SeaDropErrorsAndEvents {
/**
* @notice The SeaDrop token types, emitted as part of
* `event SeaDropTokenDeployed`.
*/
enum SEADROP_TOKEN_TYPE {
ERC721_STANDARD,
ERC721_CLONE,
ERC721_UPGRADEABLE,
ERC1155_STANDARD,
ERC1155_CLONE,
ERC1155_UPGRADEABLE
}
/**
* @notice An event to signify that a SeaDrop token contract was deployed.
*/
event SeaDropTokenDeployed(SEADROP_TOKEN_TYPE tokenType);
/**
* @notice Revert with an error if the function selector is not supported.
*/
error UnsupportedFunctionSelector(bytes4 selector);
/**
* @dev Revert with an error if the drop stage is not active.
*/
error NotActive(
uint256 currentTimestamp,
uint256 startTimestamp,
uint256 endTimestamp
);
/**
* @dev Revert with an error if the mint quantity exceeds the max allowed
* to be minted per wallet.
*/
error MintQuantityExceedsMaxMintedPerWallet(uint256 total, uint256 allowed);
/**
* @dev Revert with an error if the mint quantity exceeds the max token
* supply.
*/
error MintQuantityExceedsMaxSupply(uint256 total, uint256 maxSupply);
/**
* @dev Revert with an error if the mint quantity exceeds the max token
* supply for the stage.
* Note: The `maxTokenSupplyForStage` for public mint is
* always `type(uint).max`.
*/
error MintQuantityExceedsMaxTokenSupplyForStage(
uint256 total,
uint256 maxTokenSupplyForStage
);
/**
* @dev Revert if the fee recipient is the zero address.
*/
error FeeRecipientCannotBeZeroAddress();
/**
* @dev Revert if the fee recipient is not already included.
*/
error FeeRecipientNotPresent();
/**
* @dev Revert if the fee basis points is greater than 10_000.
*/
error InvalidFeeBps(uint256 feeBps);
/**
* @dev Revert if the fee recipient is already included.
*/
error DuplicateFeeRecipient();
/**
* @dev Revert if the fee recipient is restricted and not allowed.
*/
error FeeRecipientNotAllowed(address got);
/**
* @dev Revert if the creator payout address is the zero address.
*/
error CreatorPayoutAddressCannotBeZeroAddress();
/**
* @dev Revert if the creator payouts are not set.
*/
error CreatorPayoutsNotSet();
/**
* @dev Revert if the creator payout basis points are zero.
*/
error CreatorPayoutBasisPointsCannotBeZero();
/**
* @dev Revert if the total basis points for the creator payouts
* don't equal exactly 10_000.
*/
error InvalidCreatorPayoutTotalBasisPoints(
uint256 totalReceivedBasisPoints
);
/**
* @dev Revert if the creator payout basis points don't add up to 10_000.
*/
error InvalidCreatorPayoutBasisPoints(uint256 totalReceivedBasisPoints);
/**
* @dev Revert with an error if the allow list proof is invalid.
*/
error InvalidProof();
/**
* @dev Revert if a supplied signer address is the zero address.
*/
error SignerCannotBeZeroAddress();
/**
* @dev Revert with an error if a signer is not included in
* the enumeration when removing.
*/
error SignerNotPresent();
/**
* @dev Revert with an error if a payer is not included in
* the enumeration when removing.
*/
error PayerNotPresent();
/**
* @dev Revert with an error if a payer is already included in mapping
* when adding.
*/
error DuplicatePayer();
/**
* @dev Revert with an error if a signer is already included in mapping
* when adding.
*/
error DuplicateSigner();
/**
* @dev Revert with an error if the payer is not allowed. The minter must
* pay for their own mint.
*/
error PayerNotAllowed(address got);
/**
* @dev Revert if a supplied payer address is the zero address.
*/
error PayerCannotBeZeroAddress();
/**
* @dev Revert if the start time is greater than the end time.
*/
error InvalidStartAndEndTime(uint256 startTime, uint256 endTime);
/**
* @dev Revert with an error if the signer payment token is not the same.
*/
error InvalidSignedPaymentToken(address got, address want);
/**
* @dev Revert with an error if supplied signed mint price is less than
* the minimum specified.
*/
error InvalidSignedMintPrice(
address paymentToken,
uint256 got,
uint256 minimum
);
/**
* @dev Revert with an error if supplied signed maxTotalMintableByWallet
* is greater than the maximum specified.
*/
error InvalidSignedMaxTotalMintableByWallet(uint256 got, uint256 maximum);
/**
* @dev Revert with an error if supplied signed
* maxTotalMintableByWalletPerToken is greater than the maximum
* specified.
*/
error InvalidSignedMaxTotalMintableByWalletPerToken(
uint256 got,
uint256 maximum
);
/**
* @dev Revert with an error if the fromTokenId is not within range.
*/
error InvalidSignedFromTokenId(uint256 got, uint256 minimum);
/**
* @dev Revert with an error if the toTokenId is not within range.
*/
error InvalidSignedToTokenId(uint256 got, uint256 maximum);
/**
* @dev Revert with an error if supplied signed start time is less than
* the minimum specified.
*/
error InvalidSignedStartTime(uint256 got, uint256 minimum);
/**
* @dev Revert with an error if supplied signed end time is greater than
* the maximum specified.
*/
error InvalidSignedEndTime(uint256 got, uint256 maximum);
/**
* @dev Revert with an error if supplied signed maxTokenSupplyForStage
* is greater than the maximum specified.
*/
error InvalidSignedMaxTokenSupplyForStage(uint256 got, uint256 maximum);
/**
* @dev Revert with an error if supplied signed feeBps is greater than
* the maximum specified, or less than the minimum.
*/
error InvalidSignedFeeBps(uint256 got, uint256 minimumOrMaximum);
/**
* @dev Revert with an error if signed mint did not specify to restrict
* fee recipients.
*/
error SignedMintsMustRestrictFeeRecipients();
/**
* @dev Revert with an error if a signature for a signed mint has already
* been used.
*/
error SignatureAlreadyUsed();
/**
* @dev Revert with an error if the contract has no balance to withdraw.
*/
error NoBalanceToWithdraw();
/**
* @dev Revert with an error if the caller is not an allowed Seaport.
*/
error InvalidCallerOnlyAllowedSeaport(address caller);
/**
* @dev Revert with an error if the order does not have the ERC1155 magic
* consideration item to signify a consecutive mint.
*/
error MustSpecifyERC1155ConsiderationItemForSeaDropMint();
/**
* @dev Revert with an error if the extra data version is not supported.
*/
error UnsupportedExtraDataVersion(uint8 version);
/**
* @dev Revert with an error if the extra data encoding is not supported.
*/
error InvalidExtraDataEncoding(uint8 version);
/**
* @dev Revert with an error if the provided substandard is not supported.
*/
error InvalidSubstandard(uint8 substandard);
/**
* @dev Revert with an error if the implementation contract is called without
* delegatecall.
*/
error OnlyDelegateCalled();
/**
* @dev Revert with an error if the provided allowed Seaport is the
* zero address.
*/
error AllowedSeaportCannotBeZeroAddress();
/**
* @dev Emit an event when allowed Seaport contracts are updated.
*/
event AllowedSeaportUpdated(address[] allowedSeaport);
/**
* @dev An event with details of a SeaDrop mint, for analytical purposes.
*
* @param payer The address who payed for the tx.
* @param dropStageIndex The drop stage index. Items minted through
* public mint have dropStageIndex of 0
*/
event SeaDropMint(address payer, uint256 dropStageIndex);
/**
* @dev An event with updated allow list data.
*
* @param previousMerkleRoot The previous allow list merkle root.
* @param newMerkleRoot The new allow list merkle root.
* @param publicKeyURI If the allow list is encrypted, the public key
* URIs that can decrypt the list.
* Empty if unencrypted.
* @param allowListURI The URI for the allow list.
*/
event AllowListUpdated(
bytes32 indexed previousMerkleRoot,
bytes32 indexed newMerkleRoot,
string[] publicKeyURI,
string allowListURI
);
/**
* @dev An event with updated drop URI.
*/
event DropURIUpdated(string newDropURI);
/**
* @dev An event with the updated creator payout address.
*/
event CreatorPayoutsUpdated(CreatorPayout[] creatorPayouts);
/**
* @dev An event with the updated allowed fee recipient.
*/
event AllowedFeeRecipientUpdated(
address indexed feeRecipient,
bool indexed allowed
);
/**
* @dev An event with the updated signer.
*/
event SignerUpdated(address indexed signer, bool indexed allowed);
/**
* @dev An event with the updated payer.
*/
event PayerUpdated(address indexed payer, bool indexed allowed);
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
/**
* @notice A struct defining a creator payout address and basis points.
*
* @param payoutAddress The payout address.
* @param basisPoints The basis points to pay out to the creator.
* The total creator payouts must equal 10_000 bps.
*/
struct CreatorPayout {
address payoutAddress;
uint16 basisPoints;
}
/**
* @notice A struct defining allow list data (for minting an allow list).
*
* @param merkleRoot The merkle root for the allow list.
* @param publicKeyURIs If the allowListURI is encrypted, a list of URIs
* pointing to the public keys. Empty if unencrypted.
* @param allowListURI The URI for the allow list.
*/
struct AllowListData {
bytes32 merkleRoot;
string[] publicKeyURIs;
string allowListURI;
}
{
"compilationTarget": {
"src/lib/ERC1155SeaDropConfigurer.sol": "ERC1155SeaDropConfigurer"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "none"
},
"optimizer": {
"enabled": true,
"runs": 99999999
},
"remappings": [
":@openzeppelin-upgradeable/contracts/=lib/openzeppelin-contracts-upgradeable/contracts/",
":@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
":@rari-capital/solmate/=lib/seaport/lib/solmate/",
":ERC721A-Upgradeable/=lib/ERC721A-Upgradeable/contracts/",
":ERC721A/=lib/ERC721A/contracts/",
":create2-scripts/=lib/create2-helpers/script/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":forge-std/=lib/forge-std/src/",
":murky/=lib/murky/src/",
":seadrop/=src/",
":seaport-core/=lib/seaport/lib/seaport-core/",
":seaport-sol/=lib/seaport/lib/seaport-sol/",
":seaport-test-utils/=lib/seaport/test/foundry/utils/",
":seaport-types/=lib/seaport/lib/seaport-types/",
":solady/=lib/solady/"
]
}
[{"inputs":[],"name":"AllowedSeaportCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"CreatorPayoutAddressCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"CreatorPayoutBasisPointsCannotBeZero","type":"error"},{"inputs":[],"name":"CreatorPayoutsNotSet","type":"error"},{"inputs":[],"name":"DuplicateFeeRecipient","type":"error"},{"inputs":[],"name":"DuplicatePayer","type":"error"},{"inputs":[],"name":"DuplicateSigner","type":"error"},{"inputs":[],"name":"FeeRecipientCannotBeZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"got","type":"address"}],"name":"FeeRecipientNotAllowed","type":"error"},{"inputs":[],"name":"FeeRecipientNotPresent","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"InvalidCallerOnlyAllowedSeaport","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalReceivedBasisPoints","type":"uint256"}],"name":"InvalidCreatorPayoutBasisPoints","type":"error"},{"inputs":[{"internalType":"uint256","name":"totalReceivedBasisPoints","type":"uint256"}],"name":"InvalidCreatorPayoutTotalBasisPoints","type":"error"},{"inputs":[{"internalType":"uint8","name":"version","type":"uint8"}],"name":"InvalidExtraDataEncoding","type":"error"},{"inputs":[{"internalType":"uint256","name":"feeBps","type":"uint256"}],"name":"InvalidFeeBps","type":"error"},{"inputs":[{"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"internalType":"uint256","name":"toTokenId","type":"uint256"}],"name":"InvalidFromAndToTokenId","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedEndTime","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"minimumOrMaximum","type":"uint256"}],"name":"InvalidSignedFeeBps","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"InvalidSignedFromTokenId","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedMaxTokenSupplyForStage","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedMaxTotalMintableByWallet","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedMaxTotalMintableByWalletPerToken","type":"error"},{"inputs":[{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"InvalidSignedMintPrice","type":"error"},{"inputs":[{"internalType":"address","name":"got","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"InvalidSignedPaymentToken","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"InvalidSignedStartTime","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"maximum","type":"uint256"}],"name":"InvalidSignedToTokenId","type":"error"},{"inputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"InvalidStartAndEndTime","type":"error"},{"inputs":[{"internalType":"uint8","name":"substandard","type":"uint8"}],"name":"InvalidSubstandard","type":"error"},{"inputs":[],"name":"MaxSupplyMismatch","type":"error"},{"inputs":[],"name":"MintAmountsMismatch","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"MintQuantityExceedsMaxMintedPerWallet","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"allowed","type":"uint256"}],"name":"MintQuantityExceedsMaxMintedPerWalletForTokenId","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"MintQuantityExceedsMaxSupply","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"maxTokenSupplyForStage","type":"uint256"}],"name":"MintQuantityExceedsMaxTokenSupplyForStage","type":"error"},{"inputs":[],"name":"MustSpecifyERC1155ConsiderationItemForSeaDropMint","type":"error"},{"inputs":[],"name":"NoBalanceToWithdraw","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentTimestamp","type":"uint256"},{"internalType":"uint256","name":"startTimestamp","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"}],"name":"NotActive","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"OfferContainsDuplicateTokenId","type":"error"},{"inputs":[],"name":"OnlyDelegateCalled","type":"error"},{"inputs":[],"name":"PayerCannotBeZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"got","type":"address"}],"name":"PayerNotAllowed","type":"error"},{"inputs":[],"name":"PayerNotPresent","type":"error"},{"inputs":[],"name":"PublicDropStageNotPresent","type":"error"},{"inputs":[],"name":"PublicDropsMismatch","type":"error"},{"inputs":[],"name":"SignatureAlreadyUsed","type":"error"},{"inputs":[],"name":"SignedMintsMustRestrictFeeRecipients","type":"error"},{"inputs":[],"name":"SignerCannotBeZeroAddress","type":"error"},{"inputs":[],"name":"SignerNotPresent","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"startTokenId","type":"uint256"},{"internalType":"uint256","name":"endTokenId","type":"uint256"}],"name":"TokenIdNotWithinDropStageRange","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[{"internalType":"uint8","name":"version","type":"uint8"}],"name":"UnsupportedExtraDataVersion","type":"error"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"UnsupportedFunctionSelector","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"previousMerkleRoot","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"},{"indexed":false,"internalType":"string[]","name":"publicKeyURI","type":"string[]"},{"indexed":false,"internalType":"string","name":"allowListURI","type":"string"}],"name":"AllowListUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"feeRecipient","type":"address"},{"indexed":true,"internalType":"bool","name":"allowed","type":"bool"}],"name":"AllowedFeeRecipientUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"allowedSeaport","type":"address[]"}],"name":"AllowedSeaportUpdated","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"payoutAddress","type":"address"},{"internalType":"uint16","name":"basisPoints","type":"uint16"}],"indexed":false,"internalType":"struct CreatorPayout[]","name":"creatorPayouts","type":"tuple[]"}],"name":"CreatorPayoutsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newDropURI","type":"string"}],"name":"DropURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"payer","type":"address"},{"indexed":true,"internalType":"bool","name":"allowed","type":"bool"}],"name":"PayerUpdated","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint80","name":"startPrice","type":"uint80"},{"internalType":"uint80","name":"endPrice","type":"uint80"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint24","name":"fromTokenId","type":"uint24"},{"internalType":"uint24","name":"toTokenId","type":"uint24"},{"internalType":"uint16","name":"maxTotalMintableByWallet","type":"uint16"},{"internalType":"uint16","name":"maxTotalMintableByWalletPerToken","type":"uint16"},{"internalType":"uint16","name":"feeBps","type":"uint16"}],"indexed":false,"internalType":"struct PublicDrop","name":"publicDrop","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"index","type":"uint256"}],"name":"PublicDropUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"uint256","name":"dropStageIndex","type":"uint256"}],"name":"SeaDropMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum SeaDropErrorsAndEvents.SEADROP_TOKEN_TYPE","name":"tokenType","type":"uint8"}],"name":"SeaDropTokenDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"signer","type":"address"},{"indexed":true,"internalType":"bool","name":"allowed","type":"bool"}],"name":"SignerUpdated","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"DELEGATION_REGISTRY","outputs":[{"internalType":"contract IDelegationRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"fulfiller","type":"address"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifier","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct SpentItem[]","name":"minimumReceived","type":"tuple[]"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifier","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct SpentItem[]","name":"","type":"tuple[]"},{"internalType":"bytes","name":"context","type":"bytes"}],"name":"generateOrder","outputs":[{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifier","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct SpentItem[]","name":"offer","type":"tuple[]"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifier","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct ReceivedItem[]","name":"consideration","type":"tuple[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getSeaportMetadata","outputs":[{"internalType":"string","name":"name","type":"string"},{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"metadata","type":"bytes"}],"internalType":"struct Schema[]","name":"schemas","type":"tuple[]"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"uint256[]","name":"maxSupplyTokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"maxSupplyAmounts","type":"uint256[]"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"components":[{"internalType":"uint80","name":"startPrice","type":"uint80"},{"internalType":"uint80","name":"endPrice","type":"uint80"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint24","name":"fromTokenId","type":"uint24"},{"internalType":"uint24","name":"toTokenId","type":"uint24"},{"internalType":"uint16","name":"maxTotalMintableByWallet","type":"uint16"},{"internalType":"uint16","name":"maxTotalMintableByWalletPerToken","type":"uint16"},{"internalType":"uint16","name":"feeBps","type":"uint16"}],"internalType":"struct PublicDrop[]","name":"publicDrops","type":"tuple[]"},{"internalType":"uint256[]","name":"publicDropsIndexes","type":"uint256[]"},{"internalType":"string","name":"dropURI","type":"string"},{"components":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"string[]","name":"publicKeyURIs","type":"string[]"},{"internalType":"string","name":"allowListURI","type":"string"}],"internalType":"struct AllowListData","name":"allowListData","type":"tuple"},{"components":[{"internalType":"address","name":"payoutAddress","type":"address"},{"internalType":"uint16","name":"basisPoints","type":"uint16"}],"internalType":"struct CreatorPayout[]","name":"creatorPayouts","type":"tuple[]"},{"internalType":"bytes32","name":"provenanceHash","type":"bytes32"},{"internalType":"address[]","name":"allowedFeeRecipients","type":"address[]"},{"internalType":"address[]","name":"disallowedFeeRecipients","type":"address[]"},{"internalType":"address[]","name":"allowedPayers","type":"address[]"},{"internalType":"address[]","name":"disallowedPayers","type":"address[]"},{"internalType":"address[]","name":"allowedSigners","type":"address[]"},{"internalType":"address[]","name":"disallowedSigners","type":"address[]"},{"internalType":"address","name":"royaltyReceiver","type":"address"},{"internalType":"uint96","name":"royaltyBps","type":"uint96"},{"internalType":"address","name":"mintRecipient","type":"address"},{"internalType":"uint256[]","name":"mintTokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"mintAmounts","type":"uint256[]"}],"internalType":"struct MultiConfigureStruct","name":"config","type":"tuple"}],"name":"multiConfigure","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"fulfiller","type":"address"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifier","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct SpentItem[]","name":"minimumReceived","type":"tuple[]"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifier","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct SpentItem[]","name":"","type":"tuple[]"},{"internalType":"bytes","name":"context","type":"bytes"}],"name":"previewOrder","outputs":[{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifier","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct SpentItem[]","name":"offer","type":"tuple[]"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifier","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct ReceivedItem[]","name":"consideration","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"string[]","name":"publicKeyURIs","type":"string[]"},{"internalType":"string","name":"allowListURI","type":"string"}],"internalType":"struct AllowListData","name":"allowListData","type":"tuple"}],"name":"updateAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"feeRecipient","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"updateAllowedFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"allowedSeaport","type":"address[]"}],"name":"updateAllowedSeaport","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"payoutAddress","type":"address"},{"internalType":"uint16","name":"basisPoints","type":"uint16"}],"internalType":"struct CreatorPayout[]","name":"creatorPayouts","type":"tuple[]"}],"name":"updateCreatorPayouts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"dropURI","type":"string"}],"name":"updateDropURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"payer","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"updatePayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint80","name":"startPrice","type":"uint80"},{"internalType":"uint80","name":"endPrice","type":"uint80"},{"internalType":"uint40","name":"startTime","type":"uint40"},{"internalType":"uint40","name":"endTime","type":"uint40"},{"internalType":"bool","name":"restrictFeeRecipients","type":"bool"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint24","name":"fromTokenId","type":"uint24"},{"internalType":"uint24","name":"toTokenId","type":"uint24"},{"internalType":"uint16","name":"maxTotalMintableByWallet","type":"uint16"},{"internalType":"uint16","name":"maxTotalMintableByWalletPerToken","type":"uint16"},{"internalType":"uint16","name":"feeBps","type":"uint16"}],"internalType":"struct PublicDrop","name":"publicDrop","type":"tuple"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"updatePublicDrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"updateSigner","outputs":[],"stateMutability":"nonpayable","type":"function"}]