Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
0 BRNIE
Holders
208
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
7 BRNIELoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
BurnieTheFlame
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {ERC721ShipyardRedeemableMintable} from "./ERC721ShipyardRedeemableMintable.sol"; contract BurnieTheFlame is ERC721ShipyardRedeemableMintable { /// @dev Store the token URI number for each token id. mapping(uint256 => uint256) internal tokenURINumbers; constructor() ERC721ShipyardRedeemableMintable("Burnie The Flame: OpenSea Redeemable Example", "BRNIE") {} /** * @notice Hook to set tokenURINumber on mint. */ function _beforeTokenTransfer(address from, address, /* to */ uint256 id) internal virtual override { // Set tokenURINumbers on mint. if (from == address(0)) { // 60% chance of tokenURI 1 // 30% chance of tokenURI 2 // 10% chance of tokenURI 3 uint256 randomness = (uint256(keccak256(abi.encode(block.prevrandao))) % 100) + 1; uint256 tokenURINumber = 1; if (randomness >= 60 && randomness < 90) { tokenURINumber = 2; } else if (randomness >= 90) { tokenURINumber = 3; } tokenURINumbers[id] = tokenURINumber; } } /* * @notice Overrides the `tokenURI()` function to return baseURI + 1, 2, or 3 */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert TokenDoesNotExist(); uint256 tokenURINumber = tokenURINumbers[tokenId]; return string(abi.encodePacked(baseURI, _toString(tokenURINumber))); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {IERC165} from "openzeppelin-contracts/contracts/interfaces/IERC165.sol"; import {ERC721ConduitPreapproved_Solady} from "shipyard-core/src/tokens/erc721/ERC721ConduitPreapproved_Solady.sol"; import {ConsiderationItem, OfferItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {Ownable} from "solady/src/auth/Ownable.sol"; import {ERC7498NFTRedeemables} from "../lib/ERC7498NFTRedeemables.sol"; import {CampaignParams} from "../lib/RedeemablesStructs.sol"; import {IRedemptionMintable} from "../interfaces/IRedemptionMintable.sol"; import {ERC721ShipyardRedeemable} from "../ERC721ShipyardRedeemable.sol"; import {IRedemptionMintable} from "../interfaces/IRedemptionMintable.sol"; import {TraitRedemption} from "../lib/RedeemablesStructs.sol"; contract ERC721ShipyardRedeemableMintable is ERC721ShipyardRedeemable, IRedemptionMintable { /// @dev The ERC-7498 redeemables contracts. address[] internal _erc7498RedeemablesContracts; /// @dev The next token id to mint. uint256 _nextTokenId = 1; constructor(string memory name_, string memory symbol_) ERC721ShipyardRedeemable(name_, symbol_) {} function mintRedemption( uint256, /* campaignId */ address recipient, OfferItem calldata, /* offer */ ConsiderationItem[] calldata, /* consideration */ TraitRedemption[] calldata /* traitRedemptions */ ) external virtual { // Require that msg.sender is valid. _requireValidRedeemablesCaller(); // Increment nextTokenId first so more of the same token id cannot be minted through reentrancy. ++_nextTokenId; _mint(recipient, _nextTokenId - 1); } function getRedeemablesContracts() external view returns (address[] memory) { return _erc7498RedeemablesContracts; } function setRedeemablesContracts(address[] calldata redeemablesContracts) external onlyOwner { _erc7498RedeemablesContracts = redeemablesContracts; } function _requireValidRedeemablesCaller() internal view { // Allow the contract to call itself. if (msg.sender == address(this)) return; bool validCaller; for (uint256 i; i < _erc7498RedeemablesContracts.length; i++) { if (msg.sender == _erc7498RedeemablesContracts[i]) { validCaller = true; } } if (!validCaller) revert InvalidCaller(msg.sender); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721ShipyardRedeemable) returns (bool) { return interfaceId == type(IRedemptionMintable).interfaceId || ERC721ShipyardRedeemable.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import {ERC721} from "solady/src/tokens/ERC721.sol"; import { CONDUIT, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, SOLADY_ERC721_MASTER_SLOT_SEED_MASKED } from "../../lib/Constants.sol"; import {IPreapprovalForAll} from "../../interfaces/IPreapprovalForAll.sol"; abstract contract ERC721ConduitPreapproved_Solady is ERC721, IPreapprovalForAll { constructor() { emit PreapprovalForAll(CONDUIT, true); } function transferFrom(address from, address to, uint256 id) public payable virtual override { _transfer(_by(from), from, to, id); } function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { bool approved = super.isApprovedForAll(owner, operator); return (operator == CONDUIT) ? !approved : approved; } function setApprovalForAll(address operator, bool isApproved) public virtual override { /// @solidity memory-safe-assembly assembly { // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) let isConduit := eq(operator, CONDUIT) // if isConduit, flip isApproved, otherwise leave as is let storedValue := or( // isConduit && !isApproved and(isConduit, iszero(isApproved)), // !isConduit && isApproved and(iszero(isConduit), isApproved) ) // Update the `isApproved` for (`msg.sender`, `operator`). mstore(0x1c, operator) mstore(0x08, SOLADY_ERC721_MASTER_SLOT_SEED_MASKED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x30), storedValue) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator))) } } function _by(address from) internal view virtual returns (address result) { if (msg.sender == CONDUIT) { if (isApprovedForAll(from, CONDUIT)) { return address(0); } } return msg.sender; } }
// 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 Simple single owner authorization mixin. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol) /// /// @dev Note: /// This implementation does NOT auto-initialize the owner to `msg.sender`. /// You MUST call the `_initializeOwner` in the constructor / initializer. /// /// While the ownable portion follows /// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility, /// the nomenclature for the 2-step ownership handover may be unique to this codebase. abstract contract Ownable { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The caller is not authorized to call the function. error Unauthorized(); /// @dev The `newOwner` cannot be the zero address. error NewOwnerIsZeroAddress(); /// @dev The `pendingOwner` does not have a valid handover request. error NoHandoverRequest(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership is transferred from `oldOwner` to `newOwner`. /// This event is intentionally kept the same as OpenZeppelin's Ownable to be /// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173), /// despite it not being as lightweight as a single argument event. event OwnershipTransferred(address indexed oldOwner, address indexed newOwner); /// @dev An ownership handover to `pendingOwner` has been requested. event OwnershipHandoverRequested(address indexed pendingOwner); /// @dev The ownership handover to `pendingOwner` has been canceled. event OwnershipHandoverCanceled(address indexed pendingOwner); /// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`. uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE = 0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0; /// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE = 0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d; /// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`. uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE = 0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The owner slot is given by: `not(_OWNER_SLOT_NOT)`. /// It is intentionally chosen to be a high value /// to avoid collision with lower slots. /// The choice of manual storage layout is to enable compatibility /// with both regular and upgradeable contracts. uint256 private constant _OWNER_SLOT_NOT = 0x8b78c6d8; /// The ownership handover slot of `newOwner` is given by: /// ``` /// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED)) /// let handoverSlot := keccak256(0x00, 0x20) /// ``` /// It stores the expiry timestamp of the two-step ownership handover. uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Initializes the owner directly without authorization guard. /// This function must be called upon initialization, /// regardless of whether the contract is upgradeable or not. /// This is to enable generalization to both regular and upgradeable contracts, /// and to save gas in case the initial owner is not the caller. /// For performance reasons, this function will not check if there /// is an existing owner. function _initializeOwner(address newOwner) internal virtual { /// @solidity memory-safe-assembly assembly { // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Store the new value. sstore(not(_OWNER_SLOT_NOT), newOwner) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner) } } /// @dev Sets the owner directly without authorization guard. function _setOwner(address newOwner) internal virtual { /// @solidity memory-safe-assembly assembly { let ownerSlot := not(_OWNER_SLOT_NOT) // Clean the upper 96 bits. newOwner := shr(96, shl(96, newOwner)) // Emit the {OwnershipTransferred} event. log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner) // Store the new value. sstore(ownerSlot, newOwner) } } /// @dev Throws if the sender is not the owner. function _checkOwner() internal view virtual { /// @solidity memory-safe-assembly assembly { // If the caller is not the stored owner, revert. if iszero(eq(caller(), sload(not(_OWNER_SLOT_NOT)))) { mstore(0x00, 0x82b42900) // `Unauthorized()`. revert(0x1c, 0x04) } } } /// @dev Returns how long a two-step ownership handover is valid for in seconds. /// Override to return a different value if needed. /// Made internal to conserve bytecode. Wrap it in a public function if needed. function _ownershipHandoverValidFor() internal view virtual returns (uint64) { return 48 * 3600; } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC UPDATE FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Allows the owner to transfer the ownership to `newOwner`. function transferOwnership(address newOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { if iszero(shl(96, newOwner)) { mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`. revert(0x1c, 0x04) } } _setOwner(newOwner); } /// @dev Allows the owner to renounce their ownership. function renounceOwnership() public payable virtual onlyOwner { _setOwner(address(0)); } /// @dev Request a two-step ownership handover to the caller. /// The request will automatically expire in 48 hours (172800 seconds) by default. function requestOwnershipHandover() public payable virtual { unchecked { uint256 expires = block.timestamp + _ownershipHandoverValidFor(); /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to `expires`. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), expires) // Emit the {OwnershipHandoverRequested} event. log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller()) } } } /// @dev Cancels the two-step ownership handover to the caller, if any. function cancelOwnershipHandover() public payable virtual { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x20), 0) // Emit the {OwnershipHandoverCanceled} event. log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller()) } } /// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`. /// Reverts if there is no existing ownership handover requested by `pendingOwner`. function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner { /// @solidity memory-safe-assembly assembly { // Compute and set the handover slot to 0. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) let handoverSlot := keccak256(0x0c, 0x20) // If the handover does not exist, or has expired. if gt(timestamp(), sload(handoverSlot)) { mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`. revert(0x1c, 0x04) } // Set the handover slot to 0. sstore(handoverSlot, 0) } _setOwner(pendingOwner); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PUBLIC READ FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of the contract. function owner() public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { result := sload(not(_OWNER_SLOT_NOT)) } } /// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`. function ownershipHandoverExpiresAt(address pendingOwner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Compute the handover slot. mstore(0x0c, _HANDOVER_SLOT_SEED) mstore(0x00, pendingOwner) // Load the handover slot. result := sload(keccak256(0x0c, 0x20)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* MODIFIERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Marks a function as only callable by the owner. modifier onlyOwner() virtual { _checkOwner(); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {IERC20} from "openzeppelin-contracts/contracts/interfaces/IERC20.sol"; import {IERC165} from "openzeppelin-contracts/contracts/interfaces/IERC165.sol"; import {IERC721} from "openzeppelin-contracts/contracts/interfaces/IERC721.sol"; import {IERC1155} from "openzeppelin-contracts/contracts/interfaces/IERC1155.sol"; import {ERC20Burnable} from "openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import {ERC721Burnable} from "openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import {ERC1155Burnable} from "openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import {OfferItem, ConsiderationItem, SpentItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {ItemType} from "seaport-types/src/lib/ConsiderationEnums.sol"; import {DynamicTraits} from "shipyard-core/src/dynamic-traits/DynamicTraits.sol"; import {IERC7496} from "shipyard-core/src/dynamic-traits/interfaces/IERC7496.sol"; import {IERC7498} from "../interfaces/IERC7498.sol"; import {IRedemptionMintable} from "../interfaces/IRedemptionMintable.sol"; import {RedeemablesErrors} from "./RedeemablesErrors.sol"; import {Campaign, CampaignParams, CampaignRequirements, TraitRedemption} from "./RedeemablesStructs.sol"; import {BURN_ADDRESS} from "./RedeemablesConstants.sol"; contract ERC7498NFTRedeemables is IERC165, IERC7498, DynamicTraits, RedeemablesErrors { /// @dev Counter for next campaign id. uint256 private _nextCampaignId = 1; /// @dev The campaign by campaign id. mapping(uint256 campaignId => Campaign campaign) private _campaigns; /// @dev The campaign metadata URI. string private _campaignMetadataURI; /// @dev The total current redemptions by campaign id. mapping(uint256 campaignId => uint256 count) private _totalRedemptions; function redeem(uint256[] calldata considerationTokenIds, address recipient, bytes calldata extraData) public payable { // If the recipient is the null address, set to msg.sender. if (recipient == address(0)) { recipient = msg.sender; } // Get the values from extraData. ( uint256 campaignId, uint256 requirementsIndex, /* bytes32 redemptionHash */ , uint256[] memory traitRedemptionTokenIds, /* uint256 salt */ , /*bytes memory signature */ ) = abi.decode(extraData, (uint256, uint256, bytes32, uint256[], uint256, bytes)); // Get the campaign. Campaign storage campaign = _campaigns[campaignId]; // Validate the requirements index is valid. if (requirementsIndex >= campaign.requirements.length) { revert RequirementsIndexOutOfBounds(); } // Validate the campaign time and total redemptions. _validateRedemption(campaignId, campaign); // Process the redemption. _processRedemption( campaignId, campaign.requirements[requirementsIndex], considerationTokenIds, traitRedemptionTokenIds, recipient ); // Emit the Redemption event. emit Redemption( campaignId, requirementsIndex, bytes32(0), considerationTokenIds, traitRedemptionTokenIds, msg.sender ); } function getCampaign(uint256 campaignId) public view override returns (Campaign memory campaign, string memory metadataURI, uint256 totalRedemptions) { // Revert if campaign id is invalid. if (campaignId == 0 || campaignId >= _nextCampaignId) { revert InvalidCampaignId(); } // Get the campaign. campaign = _campaigns[campaignId]; // Get the campaign metadata uri. metadataURI = _campaignMetadataURI; // Get the total redemptions. totalRedemptions = _totalRedemptions[campaignId]; } /** * @notice Create a new redeemable campaign. * @dev IMPORTANT: Override this method with access role restriction. * @param campaign The campaign. * @param metadataURI The campaign metadata uri. */ function createCampaign(Campaign calldata campaign, string calldata metadataURI) public virtual returns (uint256 campaignId) { // Validate the campaign params, reverts if invalid. _validateCampaign(campaign); // Set the campaignId and increment the next one. campaignId = _nextCampaignId; ++_nextCampaignId; // Set the campaign params. _campaigns[campaignId] = campaign; // Set the campaign metadata uri if provided. if (bytes(metadataURI).length != 0) { _campaignMetadataURI = metadataURI; } emit CampaignUpdated(campaignId, campaign, _campaignMetadataURI); } function updateCampaign(uint256 campaignId, Campaign calldata campaign, string calldata metadataURI) external { // Revert if the campaign id is invalid. if (campaignId == 0 || campaignId >= _nextCampaignId) { revert InvalidCampaignId(); } // Revert if msg.sender is not the manager. address existingManager = _campaigns[campaignId].params.manager; if (existingManager != msg.sender) { revert NotManager(); } // Validate the campaign params and revert if invalid. _validateCampaign(campaign); // Set the campaign. _campaigns[campaignId] = campaign; // Update the campaign metadataURI if it was provided. if (bytes(metadataURI).length != 0) { _campaignMetadataURI = metadataURI; } emit CampaignUpdated(campaignId, campaign, _campaignMetadataURI); } function _validateCampaign(Campaign memory campaign) internal pure { // Revert if startTime is past endTime. if (campaign.params.startTime > campaign.params.endTime) { revert InvalidTime(); } // Iterate over the requirements. for (uint256 i; i < campaign.requirements.length;) { CampaignRequirements memory requirement = campaign.requirements[i]; // Validate each consideration item. for (uint256 j = 0; j < requirement.consideration.length;) { ConsiderationItem memory c = requirement.consideration[j]; // Revert if any of the consideration item recipients is the zero address. // 0xdead address should be used instead. // For internal burn, override _internalBurn and set _useInternalBurn to true. if (c.recipient == address(0)) { revert ConsiderationItemRecipientCannotBeZeroAddress(); } if (c.startAmount == 0) { revert ConsiderationItemAmountCannotBeZero(); } // Revert if startAmount != endAmount, as this requires more complex logic. if (c.startAmount != c.endAmount) { revert NonMatchingConsiderationItemAmounts(i, c.startAmount, c.endAmount); } unchecked { ++j; } } unchecked { ++i; } } } function _validateRedemption(uint256 campaignId, Campaign storage campaign) internal view { if (_isInactive(campaign.params.startTime, campaign.params.endTime)) { revert NotActive_(block.timestamp, campaign.params.startTime, campaign.params.endTime); } // Revert if max total redemptions would be exceeded. if (_totalRedemptions[campaignId] + 1 > campaign.params.maxCampaignRedemptions) { revert MaxCampaignRedemptionsReached( _totalRedemptions[campaignId] + 1, campaign.params.maxCampaignRedemptions ); } } function _transferConsiderationItem(uint256 id, ConsiderationItem memory c) internal { // WITH_CRITERIA with identifier 0 is wildcard: any id is valid. // Criteria is not yet implemented, for that functionality use the contract offerer. if ( id != c.identifierOrCriteria && c.identifierOrCriteria != 0 && (c.itemType != ItemType.ERC721_WITH_CRITERIA || c.itemType != ItemType.ERC1155_WITH_CRITERIA) ) { revert InvalidConsiderationTokenIdSupplied(c.token, id, c.identifierOrCriteria); } // If consideration item is this contract, recipient is burn address, and _useInternalBurn() fn returns true, // call the internal burn function and return. if (c.token == address(this) && c.recipient == payable(BURN_ADDRESS) && _useInternalBurn()) { _internalBurn(msg.sender, id, c.startAmount); } else { // Transfer the token to the consideration recipient. if (c.itemType == ItemType.ERC721 || c.itemType == ItemType.ERC721_WITH_CRITERIA) { // If recipient is the burn address, try burning the token first, if that doesn't work use transfer. if (c.recipient == payable(BURN_ADDRESS)) { try ERC721Burnable(c.token).burn(id) { // If the burn worked, return. return; } catch { // If the burn failed, transfer the token. IERC721(c.token).safeTransferFrom(msg.sender, c.recipient, id); } } else { IERC721(c.token).safeTransferFrom(msg.sender, c.recipient, id); } } else if ((c.itemType == ItemType.ERC1155 || c.itemType == ItemType.ERC1155_WITH_CRITERIA)) { if (c.recipient == payable(BURN_ADDRESS)) { // If recipient is the burn address, try burning the token first, if that doesn't work use transfer. try ERC1155Burnable(c.token).burn(msg.sender, id, c.startAmount) { // If the burn worked, return. return; } catch { // If the burn failed, transfer the token. IERC1155(c.token).safeTransferFrom(msg.sender, c.recipient, id, c.startAmount, ""); } } else { IERC1155(c.token).safeTransferFrom(msg.sender, c.recipient, id, c.startAmount, ""); } } else if (c.itemType == ItemType.ERC20) { if (c.recipient == payable(BURN_ADDRESS)) { // If recipient is the burn address, try burning the token first, if that doesn't work use transfer. try ERC20Burnable(c.token).burnFrom(msg.sender, c.startAmount) { // If the burn worked, return. return; } catch { // If the burn failed, transfer the token. IERC20(c.token).transferFrom(msg.sender, c.recipient, c.startAmount); } } else { IERC20(c.token).transferFrom(msg.sender, c.recipient, c.startAmount); } } else { // ItemType.NATIVE (bool success,) = c.recipient.call{value: msg.value}(""); if (!success) revert EtherTransferFailed(); } } } /// @dev Override this function to return true if `_internalBurn` is used. function _useInternalBurn() internal pure virtual returns (bool) { return false; } /// @dev Function that is called to burn amounts of a token internal to this inherited contract. /// Override with token implementation calling internal burn. function _internalBurn(address from, uint256 id, uint256 amount) internal virtual { // Override with your token implementation calling internal burn. } function _isInactive(uint256 startTime, uint256 endTime) internal view returns (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())) } } function _processRedemption( uint256 campaignId, CampaignRequirements memory requirements, uint256[] memory considerationTokenIds, uint256[] memory traitRedemptionTokenIds, address recipient ) internal { // Increment the campaign's total redemptions. ++_totalRedemptions[campaignId]; if (requirements.traitRedemptions.length > 0) { // Process the trait redemptions. _processTraitRedemptions(requirements.traitRedemptions, traitRedemptionTokenIds); } if (requirements.consideration.length > 0) { // Process the consideration items. _processConsiderationItems(requirements.consideration, considerationTokenIds); } if (requirements.offer.length > 0) { // Process the offer items. _processOfferItems( campaignId, requirements.consideration, requirements.offer, requirements.traitRedemptions, recipient ); } } function _processConsiderationItems( ConsiderationItem[] memory consideration, uint256[] memory considerationTokenIds ) internal { // Revert if the tokenIds length does not match the consideration length. if (consideration.length != considerationTokenIds.length) { revert ConsiderationTokenIdsDontMatchConsiderationLength(consideration.length, considerationTokenIds.length); } // Keep track of the total native value to validate. uint256 totalNativeValue; // Iterate over the consideration items. for (uint256 i; i < consideration.length;) { // Get the consideration item. ConsiderationItem memory c = consideration[i]; // Get the identifier. uint256 id = considerationTokenIds[i]; // Get the token balance. uint256 balance; if (c.itemType == ItemType.ERC721 || c.itemType == ItemType.ERC721_WITH_CRITERIA) { balance = IERC721(c.token).ownerOf(id) == msg.sender ? 1 : 0; } else if (c.itemType == ItemType.ERC1155 || c.itemType == ItemType.ERC1155_WITH_CRITERIA) { balance = IERC1155(c.token).balanceOf(msg.sender, id); } else if (c.itemType == ItemType.ERC20) { balance = IERC20(c.token).balanceOf(msg.sender); } else { // ItemType.NATIVE totalNativeValue += c.startAmount; // Total native value is validated after the loop. } // Ensure the balance is sufficient. if (c.itemType != ItemType.NATIVE && balance < c.startAmount) { revert ConsiderationItemInsufficientBalance(c.token, balance, c.startAmount); } // Transfer the consideration item. _transferConsiderationItem(id, c); unchecked { ++i; } } // Validate the correct native value is sent with the transaction. if (msg.value != totalNativeValue) { revert InvalidTxValue(msg.value, totalNativeValue); } } function _processTraitRedemptions( TraitRedemption[] memory traitRedemptions, uint256[] memory traitRedemptionTokenIds ) internal { if (traitRedemptions.length != traitRedemptionTokenIds.length) { revert TraitRedemptionTokenIdsDontMatchTraitRedemptionsLength( traitRedemptions.length, traitRedemptionTokenIds.length ); } _setTraits(traitRedemptions, traitRedemptionTokenIds); } function _processOfferItems( uint256 campaignId, ConsiderationItem[] memory consideration, OfferItem[] memory offer, TraitRedemption[] memory traitRedemptions, address recipient ) internal { // Mint the new tokens. for (uint256 i; i < offer.length;) { OfferItem memory offerItem = offer[i]; IRedemptionMintable(offerItem.token).mintRedemption( campaignId, recipient, offerItem, consideration, traitRedemptions ); unchecked { ++i; } } } function _setTraits(TraitRedemption[] memory traitRedemptions, uint256[] memory traitRedemptionTokenIds) internal { // Iterate over the trait redemptions and set traits on the tokens. for (uint256 i; i < traitRedemptions.length;) { // Get the trait redemption identifier and place on the stack. uint256 identifier = traitRedemptionTokenIds[i]; // Declare a new block to manage stack depth. { // Get the substandard and place on the stack. uint8 substandard = traitRedemptions[i].substandard; // Get the substandard value and place on the stack. bytes32 substandardValue = traitRedemptions[i].substandardValue; // Get the token and place on the stack. address token = traitRedemptions[i].token; // Get the trait key and place on the stack. bytes32 traitKey = traitRedemptions[i].traitKey; // Get the trait value and place on the stack. bytes32 traitValue = traitRedemptions[i].traitValue; // Get the current trait value and place on the stack. bytes32 currentTraitValue = IERC7496(token).getTraitValue(identifier, traitKey); // If substandard is 1, set trait to traitValue. if (substandard == 1) { // Revert if the current trait value does not match the substandard value. if (currentTraitValue != substandardValue) { revert InvalidRequiredTraitValue( token, identifier, traitKey, currentTraitValue, substandardValue ); } // Set the trait to the trait value. IERC7496(token).setTrait(identifier, traitRedemptions[i].traitKey, traitValue); // If substandard is 2, increment trait by traitValue. } else if (substandard == 2) { // Revert if the current trait value is greater than the substandard value. if (currentTraitValue > substandardValue) { revert InvalidRequiredTraitValue( token, identifier, traitKey, currentTraitValue, substandardValue ); } // Increment the trait by the trait value. uint256 newTraitValue = uint256(currentTraitValue) + uint256(traitValue); IERC7496(token).setTrait(identifier, traitRedemptions[i].traitKey, bytes32(newTraitValue)); } else if (substandard == 3) { // Revert if the current trait value is less than the substandard value. if (currentTraitValue < substandardValue) { revert InvalidRequiredTraitValue( token, identifier, traitKey, currentTraitValue, substandardValue ); } uint256 newTraitValue = uint256(currentTraitValue) - uint256(traitValue); // Decrement the trait by the trait value. IERC7496(token).setTrait(identifier, traitRedemptions[i].traitKey, bytes32(newTraitValue)); } else if (substandard == 4) { // Revert if the current trait value is not equal to the trait value. if (currentTraitValue != traitValue) { revert InvalidRequiredTraitValue( token, identifier, traitKey, currentTraitValue, substandardValue ); } // No-op: substandard 4 has no set trait action. } } unchecked { ++i; } } } function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, DynamicTraits) returns (bool) { return interfaceId == type(IERC7498).interfaceId || interfaceId == type(IERC165).interfaceId || interfaceId == type(IERC7496).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {OfferItem, ConsiderationItem, SpentItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; struct Campaign { CampaignParams params; CampaignRequirements[] requirements; } struct CampaignParams { uint32 startTime; uint32 endTime; uint32 maxCampaignRedemptions; address manager; address signer; } struct CampaignRequirements { OfferItem[] offer; ConsiderationItem[] consideration; TraitRedemption[] traitRedemptions; } struct TraitRedemption { uint8 substandard; address token; bytes32 traitKey; bytes32 traitValue; bytes32 substandardValue; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {ConsiderationItem, OfferItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {TraitRedemption} from "../lib/RedeemablesStructs.sol"; interface IRedemptionMintable { function mintRedemption( uint256 campaignId, address recipient, OfferItem calldata offer, ConsiderationItem[] calldata consideration, TraitRedemption[] calldata traitRedemptions ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {ERC721ShipyardContractMetadata} from "./lib/ERC721ShipyardContractMetadata.sol"; import {ERC7498NFTRedeemables} from "./lib/ERC7498NFTRedeemables.sol"; import {DynamicTraits} from "shipyard-core/src/dynamic-traits/DynamicTraits.sol"; import {Campaign} from "./lib/RedeemablesStructs.sol"; contract ERC721ShipyardRedeemable is ERC721ShipyardContractMetadata, ERC7498NFTRedeemables { constructor(string memory name_, string memory symbol_) ERC721ShipyardContractMetadata(name_, symbol_) {} function createCampaign(Campaign calldata campaign, string calldata metadataURI) public override onlyOwner returns (uint256 campaignId) { campaignId = ERC7498NFTRedeemables.createCampaign(campaign, metadataURI); } function setTrait(uint256 tokenId, bytes32 traitKey, bytes32 value) public virtual override onlyOwner { if (!_exists(tokenId)) revert TokenDoesNotExist(); DynamicTraits.setTrait(tokenId, traitKey, value); } function getTraitValue(uint256 tokenId, bytes32 traitKey) public view virtual override returns (bytes32 traitValue) { if (!_exists(tokenId)) revert TokenDoesNotExist(); traitValue = DynamicTraits.getTraitValue(tokenId, traitKey); } function getTraitValues(uint256 tokenId, bytes32[] calldata traitKeys) public view virtual override returns (bytes32[] memory traitValues) { if (!_exists(tokenId)) revert TokenDoesNotExist(); traitValues = DynamicTraits.getTraitValues(tokenId, traitKeys); } function burn(uint256 tokenId) public { _burn(msg.sender, tokenId); } function _useInternalBurn() internal pure virtual override returns (bool) { return true; } function _internalBurn( address, /* from */ uint256 id, uint256 /* amount */ ) internal virtual override { _burn(id); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721ShipyardContractMetadata, ERC7498NFTRedeemables) returns (bool) { return ERC721ShipyardContractMetadata.supportsInterface(interfaceId) || ERC7498NFTRedeemables.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC721 implementation with storage hitchhiking. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC721.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC721/ERC721.sol) /// /// @dev Note: /// - The ERC721 standard allows for self-approvals. /// For performance, this implementation WILL NOT revert for such actions. /// Please add any checks with overrides if desired. /// - For performance, methods are made payable where permitted by the ERC721 standard. /// - The `safeTransfer` functions use the identity precompile (0x4) /// to copy memory internally. /// /// If you are overriding: /// - NEVER violate the ERC721 invariant: /// the balance of an owner MUST be always be equal to their number of ownership slots. /// The transfer functions do not have an underflow guard for user token balances. /// - Make sure all variables written to storage are properly cleaned // (e.g. the bool value for `isApprovedForAll` MUST be either 1 or 0 under the hood). /// - Check that the overridden function is actually used in the function you want to /// change the behavior of. Much of the code has been manually inlined for performance. abstract contract ERC721 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev An account can hold up to 4294967295 tokens. uint256 internal constant _MAX_ACCOUNT_BALANCE = 0xffffffff; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Only the token owner or an approved account can manage the token. error NotOwnerNorApproved(); /// @dev The token does not exist. error TokenDoesNotExist(); /// @dev The token already exists. error TokenAlreadyExists(); /// @dev Cannot query the balance for the zero address. error BalanceQueryForZeroAddress(); /// @dev Cannot mint or transfer to the zero address. error TransferToZeroAddress(); /// @dev The token must be owned by `from`. error TransferFromIncorrectOwner(); /// @dev The recipient's balance has overflowed. error AccountBalanceOverflow(); /// @dev Cannot safely transfer to a contract that does not implement /// the ERC721Receiver interface. error TransferToNonERC721ReceiverImplementer(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Emitted when token `id` is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 indexed id); /// @dev Emitted when `owner` enables `account` to manage the `id` token. event Approval(address indexed owner, address indexed account, uint256 indexed id); /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership data slot of `id` is given by: /// ``` /// mstore(0x00, id) /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) /// let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) /// ``` /// Bits Layout: /// - [0..159] `addr` /// - [160..255] `extraData` /// /// The approved address slot is given by: `add(1, ownershipSlot)`. /// /// See: https://notes.ethereum.org/%40vbuterin/verkle_tree_eip /// /// The balance slot of `owner` is given by: /// ``` /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) /// mstore(0x00, owner) /// let balanceSlot := keccak256(0x0c, 0x1c) /// ``` /// Bits Layout: /// - [0..31] `balance` /// - [32..255] `aux` /// /// The `operator` approval slot of `owner` is given by: /// ``` /// mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) /// mstore(0x00, owner) /// let operatorApprovalSlot := keccak256(0x0c, 0x30) /// ``` uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192; /// @dev Pre-shifted and pre-masked constant. uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC721 METADATA */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the token collection name. function name() public view virtual returns (string memory); /// @dev Returns the token collection symbol. function symbol() public view virtual returns (string memory); /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. function tokenURI(uint256 id) public view virtual returns (string memory); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC721 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of token `id`. /// /// Requirements: /// - Token `id` must exist. function ownerOf(uint256 id) public view virtual returns (address result) { result = _ownerOf(id); /// @solidity memory-safe-assembly assembly { if iszero(result) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } } } /// @dev Returns the number of tokens owned by `owner`. /// /// Requirements: /// - `owner` must not be the zero address. function balanceOf(address owner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Revert if the `owner` is the zero address. if iszero(owner) { mstore(0x00, 0x8f4eb604) // `BalanceQueryForZeroAddress()`. revert(0x1c, 0x04) } mstore(0x1c, _ERC721_MASTER_SLOT_SEED) mstore(0x00, owner) result := and(sload(keccak256(0x0c, 0x1c)), _MAX_ACCOUNT_BALANCE) } } /// @dev Returns the account approved to manage token `id`. /// /// Requirements: /// - Token `id` must exist. function getApproved(uint256 id) public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) if iszero(shl(96, sload(ownershipSlot))) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } result := sload(add(1, ownershipSlot)) } } /// @dev Sets `account` as the approved account to manage token `id`. /// /// Requirements: /// - Token `id` must exist. /// - The caller must be the owner of the token, /// or an approved operator for the token owner. /// /// Emits an {Approval} event. function approve(address account, uint256 id) public payable virtual { _approve(msg.sender, account, id); } /// @dev Returns whether `operator` is approved to manage the tokens of `owner`. function isApprovedForAll(address owner, address operator) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { mstore(0x1c, operator) mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) mstore(0x00, owner) result := sload(keccak256(0x0c, 0x30)) } } /// @dev Sets whether `operator` is approved to manage the tokens of the caller. /// /// Emits an {ApprovalForAll} event. function setApprovalForAll(address operator, bool isApproved) public virtual { /// @solidity memory-safe-assembly assembly { // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) // Update the `isApproved` for (`msg.sender`, `operator`). mstore(0x1c, operator) mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x30), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) log3( 0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)) ) } } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 id) public payable virtual { _beforeTokenTransfer(from, to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. let bitmaskAddress := shr(96, not(0)) from := and(bitmaskAddress, from) to := and(bitmaskAddress, to) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, caller())) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) let owner := and(bitmaskAddress, ownershipPacked) // Revert if `from` is not the owner, or does not exist. if iszero(mul(owner, eq(owner, from))) { if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } mstore(0x00, 0xa1148100) // `TransferFromIncorrectOwner()`. revert(0x1c, 0x04) } // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Load, check, and update the token approval. { mstore(0x00, from) let approvedAddress := sload(add(1, ownershipSlot)) // Revert if the caller is not the owner, nor approved. if iszero(or(eq(caller(), from), eq(caller(), approvedAddress))) { if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Delete the approved address if any. if approvedAddress { sstore(add(1, ownershipSlot), 0) } } // Update with the new owner. sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) // Decrement the balance of `from`. { let fromBalanceSlot := keccak256(0x0c, 0x1c) sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) } // Increment the balance of `to`. { mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x1c) let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceSlotPacked) } // Emit the {Transfer} event. log4(0x00, 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) } _afterTokenTransfer(from, to, id); } /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`. function safeTransferFrom(address from, address to, uint256 id) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function safeTransferFrom(address from, address to, uint256 id, bytes calldata data) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f. result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL QUERY FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns if token `id` exists. function _exists(uint256 id) internal view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := iszero(iszero(shl(96, sload(add(id, add(id, keccak256(0x00, 0x20))))))) } } /// @dev Returns the owner of token `id`. /// Returns the zero address instead of reverting if the token does not exist. function _ownerOf(uint256 id) internal view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := shr(96, shl(96, sload(add(id, add(id, keccak256(0x00, 0x20)))))) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL DATA HITCHHIKING FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // For performance, no events are emitted for the hitchhiking setters. // Please emit your own events if required. /// @dev Returns the auxiliary data for `owner`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _getAux(address owner) internal view virtual returns (uint224 result) { /// @solidity memory-safe-assembly assembly { mstore(0x1c, _ERC721_MASTER_SLOT_SEED) mstore(0x00, owner) result := shr(32, sload(keccak256(0x0c, 0x1c))) } } /// @dev Set the auxiliary data for `owner` to `value`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _setAux(address owner, uint224 value) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x1c, _ERC721_MASTER_SLOT_SEED) mstore(0x00, owner) let balanceSlot := keccak256(0x0c, 0x1c) let packed := sload(balanceSlot) sstore(balanceSlot, xor(packed, shl(32, xor(value, shr(32, packed))))) } } /// @dev Returns the extra data for token `id`. /// Minting, transferring, burning a token will not change the extra data. /// The extra data can be set on a non-existent token. function _getExtraData(uint256 id) internal view virtual returns (uint96 result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := shr(160, sload(add(id, add(id, keccak256(0x00, 0x20))))) } } /// @dev Sets the extra data for token `id` to `value`. /// Minting, transferring, burning a token will not change the extra data. /// The extra data can be set on a non-existent token. function _setExtraData(uint256 id, uint96 value) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let packed := sload(ownershipSlot) sstore(ownershipSlot, xor(packed, shl(160, xor(value, shr(160, packed))))) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL MINT FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Mints token `id` to `to`. /// /// Requirements: /// /// - Token `id` must not exist. /// - `to` cannot be the zero address. /// /// Emits a {Transfer} event. function _mint(address to, uint256 id) internal virtual { _beforeTokenTransfer(address(0), to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. to := shr(96, shl(96, to)) // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Load the ownership data. mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) // Revert if the token already exists. if shl(96, ownershipPacked) { mstore(0x00, 0xc991cbb1) // `TokenAlreadyExists()`. revert(0x1c, 0x04) } // Update with the owner. sstore(ownershipSlot, or(ownershipPacked, to)) // Increment the balance of the owner. { mstore(0x00, to) let balanceSlot := keccak256(0x0c, 0x1c) let balanceSlotPacked := add(sload(balanceSlot), 1) if iszero(and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE)) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(balanceSlot, balanceSlotPacked) } // Emit the {Transfer} event. log4(0x00, 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id) } _afterTokenTransfer(address(0), to, id); } /// @dev Equivalent to `_safeMint(to, id, "")`. function _safeMint(address to, uint256 id) internal virtual { _safeMint(to, id, ""); } /// @dev Mints token `id` to `to`. /// /// Requirements: /// /// - Token `id` must not exist. /// - `to` cannot be the zero address. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function _safeMint(address to, uint256 id, bytes memory data) internal virtual { _mint(to, id); if (_hasCode(to)) _checkOnERC721Received(address(0), to, id, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL BURN FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_burn(address(0), id)`. function _burn(uint256 id) internal virtual { _burn(address(0), id); } /// @dev Destroys token `id`, using `by`. /// /// Requirements: /// /// - Token `id` must exist. /// - If `by` is not the zero address, /// it must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _burn(address by, uint256 id) internal virtual { address owner = ownerOf(id); _beforeTokenTransfer(owner, address(0), id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. by := shr(96, shl(96, by)) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) // Reload the owner in case it is changed in `_beforeTokenTransfer`. owner := shr(96, shl(96, ownershipPacked)) // Revert if the token does not exist. if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } // Load and check the token approval. { mstore(0x00, owner) let approvedAddress := sload(add(1, ownershipSlot)) // If `by` is not the zero address, do the authorization check. // Revert if the `by` is not the owner, nor approved. if iszero(or(iszero(by), or(eq(by, owner), eq(by, approvedAddress)))) { if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Delete the approved address if any. if approvedAddress { sstore(add(1, ownershipSlot), 0) } } // Clear the owner. sstore(ownershipSlot, xor(ownershipPacked, owner)) // Decrement the balance of `owner`. { let balanceSlot := keccak256(0x0c, 0x1c) sstore(balanceSlot, sub(sload(balanceSlot), 1)) } // Emit the {Transfer} event. log4(0x00, 0x00, _TRANSFER_EVENT_SIGNATURE, owner, 0, id) } _afterTokenTransfer(owner, address(0), id); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL APPROVAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns whether `account` is the owner of token `id`, or is approved to manage it. /// /// Requirements: /// - Token `id` must exist. function _isApprovedOrOwner(address account, uint256 id) internal view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { result := 1 // Clear the upper 96 bits. account := shr(96, shl(96, account)) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, account)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let owner := shr(96, shl(96, sload(ownershipSlot))) // Revert if the token does not exist. if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } // Check if `account` is the `owner`. if iszero(eq(account, owner)) { mstore(0x00, owner) // Check if `account` is approved to manage the token. if iszero(sload(keccak256(0x0c, 0x30))) { result := eq(account, sload(add(1, ownershipSlot))) } } } } /// @dev Returns the account approved to manage token `id`. /// Returns the zero address instead of reverting if the token does not exist. function _getApproved(uint256 id) internal view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := sload(add(1, add(id, add(id, keccak256(0x00, 0x20))))) } } /// @dev Equivalent to `_approve(address(0), account, id)`. function _approve(address account, uint256 id) internal virtual { _approve(address(0), account, id); } /// @dev Sets `account` as the approved account to manage token `id`, using `by`. /// /// Requirements: /// - Token `id` must exist. /// - If `by` is not the zero address, `by` must be the owner /// or an approved operator for the token owner. /// /// Emits a {Transfer} event. function _approve(address by, address account, uint256 id) internal virtual { assembly { // Clear the upper 96 bits. let bitmaskAddress := shr(96, not(0)) account := and(bitmaskAddress, account) by := and(bitmaskAddress, by) // Load the owner of the token. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let owner := and(bitmaskAddress, sload(ownershipSlot)) // Revert if the token does not exist. if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } // If `by` is not the zero address, do the authorization check. // Revert if `by` is not the owner, nor approved. if iszero(or(iszero(by), eq(by, owner))) { mstore(0x00, owner) if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Sets `account` as the approved account to manage `id`. sstore(add(1, ownershipSlot), account) // Emit the {Approval} event. log4(0x00, 0x00, _APPROVAL_EVENT_SIGNATURE, owner, account, id) } } /// @dev Approve or remove the `operator` as an operator for `by`, /// without authorization checks. /// /// Emits an {ApprovalForAll} event. function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual { /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. by := shr(96, shl(96, by)) operator := shr(96, shl(96, operator)) // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) // Update the `isApproved` for (`by`, `operator`). mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) mstore(0x00, by) sstore(keccak256(0x0c, 0x30), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, by, operator) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL TRANSFER FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_transfer(address(0), from, to, id)`. function _transfer(address from, address to, uint256 id) internal virtual { _transfer(address(0), from, to, id); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - If `by` is not the zero address, /// it must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _transfer(address by, address from, address to, uint256 id) internal virtual { _beforeTokenTransfer(from, to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. let bitmaskAddress := shr(96, not(0)) from := and(bitmaskAddress, from) to := and(bitmaskAddress, to) by := and(bitmaskAddress, by) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) let owner := and(bitmaskAddress, ownershipPacked) // Revert if `from` is not the owner, or does not exist. if iszero(mul(owner, eq(owner, from))) { if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } mstore(0x00, 0xa1148100) // `TransferFromIncorrectOwner()`. revert(0x1c, 0x04) } // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Load, check, and update the token approval. { mstore(0x00, from) let approvedAddress := sload(add(1, ownershipSlot)) // If `by` is not the zero address, do the authorization check. // Revert if the `by` is not the owner, nor approved. if iszero(or(iszero(by), or(eq(by, from), eq(by, approvedAddress)))) { if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Delete the approved address if any. if approvedAddress { sstore(add(1, ownershipSlot), 0) } } // Update with the new owner. sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) // Decrement the balance of `from`. { let fromBalanceSlot := keccak256(0x0c, 0x1c) sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) } // Increment the balance of `to`. { mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x1c) let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceSlotPacked) } // Emit the {Transfer} event. log4(0x00, 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) } _afterTokenTransfer(from, to, id); } /// @dev Equivalent to `_safeTransfer(from, to, id, "")`. function _safeTransfer(address from, address to, uint256 id) internal virtual { _safeTransfer(from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function _safeTransfer(address from, address to, uint256 id, bytes memory data) internal virtual { _transfer(address(0), from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /// @dev Equivalent to `_safeTransfer(by, from, to, id, "")`. function _safeTransfer(address by, address from, address to, uint256 id) internal virtual { _safeTransfer(by, from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - If `by` is not the zero address, /// it must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function _safeTransfer(address by, address from, address to, uint256 id, bytes memory data) internal virtual { _transfer(by, from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HOOKS FOR OVERRIDING */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Hook that is called before any token transfers, including minting and burning. function _beforeTokenTransfer(address from, address to, uint256 id) internal virtual {} /// @dev Hook that is called after any token transfers, including minting and burning. function _afterTokenTransfer(address from, address to, uint256 id) internal virtual {} /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PRIVATE HELPERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data) private { /// @solidity memory-safe-assembly assembly { // Prepare the calldata. let m := mload(0x40) let onERC721ReceivedSelector := 0x150b7a02 mstore(m, onERC721ReceivedSelector) mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`. mstore(add(m, 0x40), shr(96, shl(96, from))) mstore(add(m, 0x60), id) mstore(add(m, 0x80), 0x80) let n := mload(data) mstore(add(m, 0xa0), n) if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) } // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(0x00, 0x00, returndatasize()) revert(0x00, returndatasize()) } } // Load the returndata and compare it. if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) { mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`. revert(0x1c, 0x04) } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /// @dev The canonical OpenSea conduit. address constant CONDUIT = 0x1E0049783F008A0085193E00003D00cd54003c71; /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. uint256 constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; /// @dev Pre-shifted and pre-masked constant. uint256 constant SOLADY_ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000; /// @dev Solady ERC1155 master slot seed. uint256 constant SOLADY_ERC1155_MASTER_SLOT_SEED = 0x9a31110384e0b0c9; /// @dev `keccak256(bytes("TransferSingle(address,address,address,uint256,uint256)"))`. uint256 constant SOLADY_TRANSFER_SINGLE_EVENT_SIGNATURE = 0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62; /// @dev `keccak256(bytes("TransferBatch(address,address,address,uint256[],uint256[])"))`. uint256 constant SOLADY_TRANSFER_BATCH_EVENT_SIGNATURE = 0x4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; interface IPreapprovalForAll { /// @notice Emitted when a token contract preapproves (or revokes) all token transfers from a specific address, if /// the preapproval is configurable. This allows offchain indexers to correctly reflect token approvals /// which can later be revoked. event PreapprovalForAll(address indexed operator, bool indexed approved); }
// 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; 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 // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol) pragma solidity ^0.8.20; import {IERC721} from "../token/ERC721/IERC721.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155.sol) pragma solidity ^0.8.20; import {IERC1155} from "../token/ERC1155/IERC1155.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.20; import {ERC20} from "../ERC20.sol"; import {Context} from "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys a `value` amount of tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 value) public virtual { _burn(_msgSender(), value); } /** * @dev Destroys a `value` amount of tokens from `account`, deducting from * the caller's allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `value`. */ function burnFrom(address account, uint256 value) public virtual { _spendAllowance(account, _msgSender(), value); _burn(account, value); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.20; import {ERC721} from "../ERC721.sol"; import {Context} from "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. _update(address(0), tokenId, _msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/extensions/ERC1155Burnable.sol) pragma solidity ^0.8.20; import {ERC1155} from "../ERC1155.sol"; /** * @dev Extension of {ERC1155} that allows token holders to destroy both their * own tokens and those that they have been approved to use. */ abstract contract ERC1155Burnable is ERC1155 { function burn(address account, uint256 id, uint256 value) public virtual { if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) { revert ERC1155MissingApprovalForAll(_msgSender(), account); } _burn(account, id, value); } function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual { if (account != _msgSender() && !isApprovedForAll(account, _msgSender())) { revert ERC1155MissingApprovalForAll(_msgSender(), account); } _burnBatch(account, ids, values); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {EnumerableSet} from "openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol"; import {IERC7496} from "./interfaces/IERC7496.sol"; contract DynamicTraits is IERC7496 { using EnumerableSet for EnumerableSet.Bytes32Set; /// @notice Thrown when a new trait value is not different from the existing value error TraitValueUnchanged(); /// @notice An enumerable set of all trait keys that have been set EnumerableSet.Bytes32Set internal _traitKeys; /// @notice A mapping of token ID to a mapping of trait key to trait value mapping(uint256 tokenId => mapping(bytes32 traitKey => bytes32 traitValue)) internal _traits; /// @notice An offchain string URI that points to a JSON file containing trait metadata string internal _traitMetadataURI; /** * @notice Get the value of a trait for a given token ID. * @param tokenId The token ID to get the trait value for * @param traitKey The trait key to get the value of */ function getTraitValue(uint256 tokenId, bytes32 traitKey) public view virtual returns (bytes32 traitValue) { traitValue = _traits[tokenId][traitKey]; } /** * @notice Get the values of traits for a given token ID. * @param tokenId The token ID to get the trait values for * @param traitKeys The trait keys to get the values of */ function getTraitValues(uint256 tokenId, bytes32[] calldata traitKeys) public view virtual returns (bytes32[] memory traitValues) { uint256 length = traitKeys.length; traitValues = new bytes32[](length); for (uint256 i = 0; i < length;) { bytes32 traitKey = traitKeys[i]; traitValues[i] = getTraitValue(tokenId, traitKey); unchecked { ++i; } } } /** * @notice Get the URI for the trait metadata */ function getTraitMetadataURI() external view virtual returns (string memory labelsURI) { return _traitMetadataURI; } /** * @notice Set the value of a trait for a given token ID. * Reverts if the trait value is unchanged. * @dev IMPORTANT: Override this method with access role restriction. * @param tokenId The token ID to set the trait value for * @param traitKey The trait key to set the value of * @param newValue The new trait value to set */ function setTrait(uint256 tokenId, bytes32 traitKey, bytes32 newValue) public virtual { bytes32 existingValue = _traits[tokenId][traitKey]; if (existingValue == newValue) { revert TraitValueUnchanged(); } // no-op if exists _traitKeys.add(traitKey); _traits[tokenId][traitKey] = newValue; emit TraitUpdated(traitKey, tokenId, newValue); } /** * @notice Set the URI for the trait metadata * @param uri The new URI to set */ function _setTraitMetadataURI(string calldata uri) internal virtual { _traitMetadataURI = uri; emit TraitMetadataURIUpdated(); } function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC7496).interfaceId; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {IERC165} from "forge-std/interfaces/IERC165.sol"; interface IERC7496 is IERC165 { /* Events */ event TraitUpdated(bytes32 indexed traitKey, uint256 tokenId, bytes32 trait); event TraitUpdatedBulkRange(bytes32 indexed traitKey, uint256 fromTokenId, uint256 toTokenId, bytes32 traitValue); event TraitUpdatedBulkList(bytes32 indexed traitKey, uint256[] tokenIds, bytes32 traitValue); event TraitMetadataURIUpdated(); /* Getters */ function getTraitValue(uint256 tokenId, bytes32 traitKey) external view returns (bytes32 traitValue); function getTraitValues(uint256 tokenId, bytes32[] calldata traitKeys) external view returns (bytes32[] memory traitValues); function getTraitMetadataURI() external view returns (string memory uri); /* Setters */ function setTrait(uint256 tokenId, bytes32 traitKey, bytes32 value) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {OfferItem, ConsiderationItem, SpentItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {Campaign, TraitRedemption} from "../lib/RedeemablesStructs.sol"; interface IERC7498 { event CampaignUpdated(uint256 indexed campaignId, Campaign campaign, string metadataURI); event Redemption( uint256 indexed campaignId, uint256 requirementsIndex, bytes32 redemptionHash, uint256[] considerationTokenIds, uint256[] traitRedemptionTokenIds, address redeemedBy ); function createCampaign(Campaign calldata campaign, string calldata metadataURI) external returns (uint256 campaignId); function updateCampaign(uint256 campaignId, Campaign calldata campaign, string calldata metadataURI) external; function getCampaign(uint256 campaignId) external view returns (Campaign memory campaign, string memory metadataURI, uint256 totalRedemptions); function redeem(uint256[] calldata considerationTokenIds, address recipient, bytes calldata extraData) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {SpentItem} from "seaport-types/src/lib/ConsiderationStructs.sol"; import {CampaignParams} from "./RedeemablesStructs.sol"; interface RedeemablesErrors { /// Configuration errors error NotManager(); error InvalidTime(); error ConsiderationItemRecipientCannotBeZeroAddress(); error ConsiderationItemAmountCannotBeZero(); error NonMatchingConsiderationItemAmounts(uint256 itemIndex, uint256 startAmount, uint256 endAmount); /// Redemption errors error InvalidCampaignId(); error CampaignAlreadyExists(); error InvalidCaller(address caller); error NotActive_(uint256 currentTimestamp, uint256 startTime, uint256 endTime); error MaxRedemptionsReached(uint256 total, uint256 max); error MaxCampaignRedemptionsReached(uint256 total, uint256 max); error NativeTransferFailed(); error InvalidOfferLength(uint256 got, uint256 want); error InvalidNativeOfferItem(); error InvalidOwner(); error InvalidRequiredTraitValue( address token, uint256 tokenId, bytes32 traitKey, bytes32 gotTraitValue, bytes32 wantTraitValue ); error InvalidTraitRedemption(); error InvalidTraitRedemptionToken(address token); error ConsiderationRecipientNotFound(address token); error RedemptionValuesAreImmutable(); error RequirementsIndexOutOfBounds(); error ConsiderationItemInsufficientBalance(address token, uint256 balance, uint256 amount); error EtherTransferFailed(); error InvalidTxValue(uint256 got, uint256 want); error InvalidConsiderationTokenIdSupplied(address token, uint256 got, uint256 want); error ConsiderationTokenIdsDontMatchConsiderationLength(uint256 considerationLength, uint256 tokenIdsLength); error TraitRedemptionTokenIdsDontMatchTraitRedemptionsLength(uint256 traitRedemptionsLength, uint256 tokenIdsLength); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; address constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; import {ERC721ConduitPreapproved_Solady} from "shipyard-core/src/tokens/erc721/ERC721ConduitPreapproved_Solady.sol"; import {ERC721} from "solady/src/tokens/ERC721.sol"; import {ERC2981} from "solady/src/tokens/ERC2981.sol"; import {Ownable} from "solady/src/auth/Ownable.sol"; import {IShipyardContractMetadata} from "../interfaces/IShipyardContractMetadata.sol"; contract ERC721ShipyardContractMetadata is ERC721ConduitPreapproved_Solady, IShipyardContractMetadata, ERC2981, Ownable { /// @dev The token name string internal _name; /// @dev The token symbol string internal _symbol; /// @dev The base URI. string public baseURI; /// @dev The contract URI. string public contractURI; /// @dev The provenance hash for guaranteeing metadata order for random reveals. bytes32 public provenanceHash; constructor(string memory name_, string memory symbol_) ERC721ConduitPreapproved_Solady() { // Set the token name and symbol. _name = name_; _symbol = symbol_; // Initialize the owner of the contract. _initializeOwner(msg.sender); } /** * @notice Returns the name of this token contract. */ function name() public view override(ERC721, IShipyardContractMetadata) returns (string memory) { return _name; } /** * @notice Returns the symbol of this token contract. */ function symbol() public view override(ERC721, IShipyardContractMetadata) returns (string memory) { return _symbol; } /** * @notice Sets the base URI for the token metadata and emits an event. * * @param newURI The new base URI to set. */ function setBaseURI(string calldata newURI) external onlyOwner { baseURI = newURI; // Emit an event with the update. emit BatchMetadataUpdate(0, type(uint256).max); } /** * @notice Sets the contract URI for contract metadata. * * @param newURI The new contract URI. */ function setContractURI(string calldata newURI) external onlyOwner { // Set the new contract URI. contractURI = newURI; // Emit an event with the update. emit ContractURIUpdated(newURI); } /** * @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 if the provenance hash has already * been set, so be sure to carefully set it only once. * * @param newProvenanceHash The new provenance hash to set. */ function setProvenanceHash(bytes32 newProvenanceHash) external onlyOwner { // Keep track of the old provenance hash for emitting with the event. bytes32 oldProvenanceHash = provenanceHash; // Revert if the provenance hash has already been set. if (oldProvenanceHash != bytes32(0)) { revert ProvenanceHashCannotBeSetAfterAlreadyBeingSet(); } // Set the new provenance hash. provenanceHash = newProvenanceHash; // Emit an event with the update. emit ProvenanceHashUpdated(oldProvenanceHash, newProvenanceHash); } /** * @notice Returns the token URI for token metadata. * * @param tokenId The token id to get the token URI for. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory uri) { // Revert if the tokenId doesn't exist. if (!_exists(tokenId)) revert TokenDoesNotExist(); // Put the baseURI on the stack. uri = baseURI; // Return empty if baseURI is empty. if (bytes(uri).length == 0) { return ""; } // If the last character of the baseURI is not a slash, then return // the baseURI to signal the same metadata for all tokens, such as // for a prereveal state. if (bytes(uri)[bytes(uri).length - 1] != bytes("/")[0]) { return uri; } // Append the tokenId to the baseURI and return. uri = string.concat(uri, _toString(tokenId)); } /** * @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 onlyOwner { // Set the default royalty. // ERC2981 implementation ensures feeNumerator <= feeDenominator // and receiver != address(0). _setDefaultRoyalty(receiver, feeNumerator); // Emit an event with the updated params. emit RoyaltyInfoUpdated(receiver, feeNumerator); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) { return ERC721.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or * {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the address zero. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the value of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] calldata accounts, uint256[] calldata ids ) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `values` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.20; import {IERC721} from "./IERC721.sol"; import {IERC721Receiver} from "./IERC721Receiver.sol"; import {IERC721Metadata} from "./extensions/IERC721Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {Strings} from "../../utils/Strings.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; import {IERC721Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors { using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; mapping(uint256 tokenId => address) private _owners; mapping(address owner => uint256) private _balances; mapping(uint256 tokenId => address) private _tokenApprovals; mapping(address owner => mapping(address operator => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual returns (uint256) { if (owner == address(0)) { revert ERC721InvalidOwner(address(0)); } return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual returns (address) { return _requireOwned(tokenId); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual returns (string memory) { _requireOwned(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual { _approve(to, tokenId, _msgSender()); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual returns (address) { _requireOwned(tokenId); return _getApproved(tokenId); } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. address previousOwner = _update(to, tokenId, _msgSender()); if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual { transferFrom(from, to, tokenId); _checkOnERC721Received(from, to, tokenId, data); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist * * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`. */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted. */ function _getApproved(uint256 tokenId) internal view virtual returns (address) { return _tokenApprovals[tokenId]; } /** * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in * particular (ignoring whether it is owned by `owner`). * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) { return spender != address(0) && (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender); } /** * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner. * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets * the `spender` for the specific `tokenId`. * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual { if (!_isAuthorized(owner, spender, tokenId)) { if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } else { revert ERC721InsufficientApproval(spender, tokenId); } } } /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that * a uint256 would ever overflow from increments when these increments are bounded to uint128 values. * * WARNING: Increasing an account's balance using this function tends to be paired with an override of the * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership * remain consistent with one another. */ function _increaseBalance(address account, uint128 value) internal virtual { unchecked { _balances[account] += value; } } /** * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update. * * The `auth` argument is optional. If the value passed is non 0, then this function will check that * `auth` is either the owner of the token, or approved to operate on the token (by the owner). * * Emits a {Transfer} event. * * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}. */ function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) { address from = _ownerOf(tokenId); // Perform (optional) operator check if (auth != address(0)) { _checkAuthorized(from, auth, tokenId); } // Execute the update if (from != address(0)) { // Clear approval. No need to re-authorize or emit the Approval event _approve(address(0), tokenId, address(0), false); unchecked { _balances[from] -= 1; } } if (to != address(0)) { unchecked { _balances[to] += 1; } } _owners[tokenId] = to; emit Transfer(from, to, tokenId); return from; } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner != address(0)) { revert ERC721InvalidSender(address(0)); } } /** * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual { _mint(to, tokenId); _checkOnERC721Received(address(0), to, tokenId, data); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal { address previousOwner = _update(address(0), tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } else if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients * are aware of the ERC721 standard to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is like {safeTransferFrom} in the sense that it invokes * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `tokenId` token must exist and be owned by `from`. * - `to` cannot be the zero address. * - `from` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId) internal { _safeTransfer(from, to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual { _transfer(from, to, tokenId); _checkOnERC721Received(from, to, tokenId, data); } /** * @dev Approve `to` to operate on `tokenId` * * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is * either the owner of the token, or approved to operate on all tokens held by this owner. * * Emits an {Approval} event. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address to, uint256 tokenId, address auth) internal { _approve(to, tokenId, auth, true); } /** * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not * emitted in the context of transfers. */ function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual { // Avoid reading the owner unless necessary if (emitEvent || auth != address(0)) { address owner = _requireOwned(tokenId); // We do not use _isAuthorized because single-token approvals should not be able to call approve if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) { revert ERC721InvalidApprover(auth); } if (emitEvent) { emit Approval(owner, to, tokenId); } } _tokenApprovals[tokenId] = to; } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Requirements: * - operator can't be the address zero. * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { if (operator == address(0)) { revert ERC721InvalidOperator(operator); } _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned). * Returns the owner. * * Overrides to ownership logic should be done to {_ownerOf}. */ function _requireOwned(uint256 tokenId) internal view returns (address) { address owner = _ownerOf(tokenId); if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } return owner; } /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private { if (to.code.length > 0) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { if (retval != IERC721Receiver.onERC721Received.selector) { revert ERC721InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { revert ERC721InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.20; import {IERC1155} from "./IERC1155.sol"; import {IERC1155Receiver} from "./IERC1155Receiver.sol"; import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol"; import {Context} from "../../utils/Context.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; import {Arrays} from "../../utils/Arrays.sol"; import {IERC1155Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 */ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors { using Arrays for uint256[]; using Arrays for address[]; mapping(uint256 id => mapping(address account => uint256)) private _balances; mapping(address account => mapping(address operator => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256 /* id */) public view virtual returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. */ function balanceOf(address account, uint256 id) public view virtual returns (uint256) { return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch( address[] memory accounts, uint256[] memory ids ) public view virtual returns (uint256[] memory) { if (accounts.length != ids.length) { revert ERC1155InvalidArrayLength(ids.length, accounts.length); } uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i)); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeTransferFrom(from, to, id, value, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeBatchTransferFrom(from, to, ids, values, data); } /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from` * (or `to`) is the zero address. * * Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise. * * Requirements: * * - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} * or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. * - `ids` and `values` must have the same length. * * NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead. */ function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual { if (ids.length != values.length) { revert ERC1155InvalidArrayLength(ids.length, values.length); } address operator = _msgSender(); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids.unsafeMemoryAccess(i); uint256 value = values.unsafeMemoryAccess(i); if (from != address(0)) { uint256 fromBalance = _balances[id][from]; if (fromBalance < value) { revert ERC1155InsufficientBalance(from, fromBalance, value, id); } unchecked { // Overflow not possible: value <= fromBalance _balances[id][from] = fromBalance - value; } } if (to != address(0)) { _balances[id][to] += value; } } if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); emit TransferSingle(operator, from, to, id, value); } else { emit TransferBatch(operator, from, to, ids, values); } } /** * @dev Version of {_update} that performs the token acceptance check by calling * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it * contains code (eg. is a smart contract at the moment of execution). * * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any * update to the contract state after this function would break the check-effect-interaction pattern. Consider * overriding {_update} instead. */ function _updateWithAcceptanceCheck( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal virtual { _update(from, to, ids, values); if (to != address(0)) { address operator = _msgSender(); if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); _doSafeTransferAcceptanceCheck(operator, from, to, id, value, data); } else { _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data); } } } /** * @dev Transfers a `value` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `value` amount. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. * - `ids` and `values` must have the same length. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, to, ids, values, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the values in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates a `value` amount of tokens of type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint(address to, uint256 id, uint256 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `values` must have the same length. * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev Destroys a `value` amount of tokens of type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. */ function _burn(address from, uint256 id, uint256 value) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. * - `ids` and `values` must have the same length. */ function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the zero address. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { if (operator == address(0)) { revert ERC1155InvalidOperator(address(0)); } _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address * if it contains code at the moment of execution. */ function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 value, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address * if it contains code at the moment of execution. */ function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Creates an array in memory with only one value for each of the elements provided. */ function _asSingletonArrays( uint256 element1, uint256 element2 ) private pure returns (uint256[] memory array1, uint256[] memory array2) { /// @solidity memory-safe-assembly assembly { // Load the free memory pointer array1 := mload(0x40) // Set array length to 1 mstore(array1, 1) // Store the single element at the next word after the length (where content starts) mstore(add(array1, 0x20), element1) // Repeat for next array locating it right after the first array array2 := add(array1, 0x40) mstore(array2, 1) mstore(add(array2, 0x20), element2) // Update the free memory pointer by pointing after the second array mstore(0x40, add(array2, 0x40)) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2; interface IERC165 { /// @notice Query if a contract implements an interface /// @param interfaceID The interface identifier, as specified in ERC-165 /// @dev Interface identification is specified in ERC-165. This function /// uses less than 30,000 gas. /// @return `true` if the contract implements `interfaceID` and /// `interfaceID` is not 0xffffffff, `false` otherwise function supportsInterface(bytes4 interfaceID) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Simple ERC2981 NFT Royalty Standard implementation. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC2981.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/common/ERC2981.sol) abstract contract ERC2981 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The royalty fee numerator exceeds the fee denominator. error RoyaltyOverflow(); /// @dev The royalty receiver cannot be the zero address. error RoyaltyReceiverIsZeroAddress(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The default royalty info is given by: /// ``` /// let packed := sload(_ERC2981_MASTER_SLOT_SEED) /// let receiver := shr(96, packed) /// let royaltyFraction := xor(packed, shl(96, receiver)) /// ``` /// /// The per token royalty info is given by. /// ``` /// mstore(0x00, tokenId) /// mstore(0x20, _ERC2981_MASTER_SLOT_SEED) /// let packed := sload(keccak256(0x00, 0x40)) /// let receiver := shr(96, packed) /// let royaltyFraction := xor(packed, shl(96, receiver)) /// ``` uint256 private constant _ERC2981_MASTER_SLOT_SEED = 0xaa4ec00224afccfdb7; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC2981 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Checks that `_feeDenominator` is non-zero. constructor() { require(_feeDenominator() != 0, "Fee denominator cannot be zero."); } /// @dev Returns the denominator for the royalty amount. /// Defaults to 10000, which represents fees in basis points. /// Override this function to return a custom amount if needed. function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC2981: 0x2a55205a. result := or(eq(s, 0x01ffc9a7), eq(s, 0x2a55205a)) } } /// @dev Returns the `receiver` and `royaltyAmount` for `tokenId` sold at `salePrice`. function royaltyInfo(uint256 tokenId, uint256 salePrice) public view virtual returns (address receiver, uint256 royaltyAmount) { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) let packed := sload(keccak256(0x00, 0x40)) receiver := shr(96, packed) if iszero(receiver) { packed := sload(mload(0x20)) receiver := shr(96, packed) } let x := salePrice let y := xor(packed, shl(96, receiver)) // `feeNumerator`. // Overflow check, equivalent to `require(y == 0 || x <= type(uint256).max / y)`. // Out-of-gas revert. Should not be triggered in practice, but included for safety. returndatacopy(returndatasize(), returndatasize(), mul(y, gt(x, div(not(0), y)))) royaltyAmount := div(mul(x, y), feeDenominator) } } /// @dev Sets the default royalty `receiver` and `feeNumerator`. /// /// Requirements: /// - `receiver` must not be the zero address. /// - `feeNumerator` must not be greater than the fee denominator. function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { feeNumerator := shr(160, shl(160, feeNumerator)) if gt(feeNumerator, feeDenominator) { mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. revert(0x1c, 0x04) } let packed := shl(96, receiver) if iszero(packed) { mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. revert(0x1c, 0x04) } sstore(_ERC2981_MASTER_SLOT_SEED, or(packed, feeNumerator)) } } /// @dev Sets the default royalty `receiver` and `feeNumerator` to zero. function _deleteDefaultRoyalty() internal virtual { /// @solidity memory-safe-assembly assembly { sstore(_ERC2981_MASTER_SLOT_SEED, 0) } } /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId`. /// /// Requirements: /// - `receiver` must not be the zero address. /// - `feeNumerator` must not be greater than the fee denominator. function _setTokenRoyalty(uint256 tokenId, address receiver, uint96 feeNumerator) internal virtual { uint256 feeDenominator = _feeDenominator(); /// @solidity memory-safe-assembly assembly { feeNumerator := shr(160, shl(160, feeNumerator)) if gt(feeNumerator, feeDenominator) { mstore(0x00, 0x350a88b3) // `RoyaltyOverflow()`. revert(0x1c, 0x04) } let packed := shl(96, receiver) if iszero(packed) { mstore(0x00, 0xb4457eaa) // `RoyaltyReceiverIsZeroAddress()`. revert(0x1c, 0x04) } mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) sstore(keccak256(0x00, 0x40), or(packed, feeNumerator)) } } /// @dev Sets the royalty `receiver` and `feeNumerator` for `tokenId` to zero. function _resetTokenRoyalty(uint256 tokenId) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, tokenId) mstore(0x20, _ERC2981_MASTER_SLOT_SEED) sstore(keccak256(0x00, 0x40), 0) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.19; interface IShipyardContractMetadata { /// @dev Emit an event for token metadata reveals/updates, according to EIP-4906. event BatchMetadataUpdate(uint256 _fromTokenId, uint256 _toTokenId); /// @dev Emit an event when the URI for the collection-level metadata is updated. event ContractURIUpdated(string uri); /// @dev Emit an event when the provenance hash is updated. event ProvenanceHashUpdated(bytes32 oldProvenanceHash, bytes32 newProvenanceHash); /// @dev Emit an event when the royalties info is updated. event RoyaltyInfoUpdated(address receiver, uint256 basisPoints); /// @dev Revert with an error when attempting to set the provenance hash after it has already been set. error ProvenanceHashCannotBeSetAfterAlreadyBeingSet(); function name() external view returns (string memory); function symbol() external view returns (string memory); function baseURI() external view returns (string memory); function contractURI() external view returns (string memory); function provenanceHash() external view returns (bytes32); function setBaseURI(string calldata newURI) external; function setContractURI(string calldata newURI) external; function setProvenanceHash(bytes32 newProvenanceHash) external; function setDefaultRoyalty(address receiver, uint96 feeNumerator) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.20; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be * reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.20; import {IERC721} from "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.20; import {IERC1155} from "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Arrays.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; import {Math} from "./math/Math.sol"; /** * @dev Collection of functions related to array types. */ library Arrays { using StorageSlot for bytes32; /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * * `array` is expected to be sorted in ascending order, and to contain no * repeated elements. */ function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { uint256 low = 0; uint256 high = array.length; if (high == 0) { return 0; } while (low < high) { uint256 mid = Math.average(low, high); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds towards zero (it does integer division with truncation). if (unsafeAccess(array, mid).value > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && unsafeAccess(array, low - 1).value == element) { return low - 1; } else { return low; } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getAddressSlot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getBytes32Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getUint256Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
{ "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "solady/=lib/solady/", "solarray/=lib/solarray/src/", "seaport-core/=lib/seaport-core/", "seaport-sol/=lib/seaport-sol/", "seaport-types/=lib/seaport-types/", "shipyard-core/=lib/shipyard-core/", "seadrop/=lib/seadrop/", "openzeppelin-contracts/=lib/shipyard-core/lib/openzeppelin-contracts/", "ERC721A/=lib/seadrop/lib/ERC721A/contracts/", "@openzeppelin-upgradeable/contracts/=lib/seadrop/lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/seadrop/lib/openzeppelin-contracts/contracts/", "@rari-capital/solmate/=lib/seadrop/lib/seaport/lib/solmate/", "ERC721A-Upgradeable/=lib/seadrop/lib/ERC721A-Upgradeable/contracts/", "create2-helpers/=lib/seadrop/lib/create2-helpers/src/", "create2-scripts/=lib/seadrop/lib/create2-helpers/script/", "erc4626-tests/=lib/seaport-sol/lib/seaport/lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "hot-chain-svg/=lib/shipyard-core/lib/hot-chain-svg/contracts/", "murky/=lib/murky/src/", "openzeppelin-contracts-upgradeable/=lib/seadrop/lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts/contracts/=lib/shipyard-core/lib/openzeppelin-contracts/contracts/", "seaport-test-utils/=lib/seadrop/lib/seaport/test/foundry/utils/", "seaport/=lib/seadrop/lib/seaport/", "solmate/=lib/seaport-sol/lib/seaport/lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 1000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "none", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountBalanceOverflow","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"CampaignAlreadyExists","type":"error"},{"inputs":[],"name":"ConsiderationItemAmountCannotBeZero","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ConsiderationItemInsufficientBalance","type":"error"},{"inputs":[],"name":"ConsiderationItemRecipientCannotBeZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"ConsiderationRecipientNotFound","type":"error"},{"inputs":[{"internalType":"uint256","name":"considerationLength","type":"uint256"},{"internalType":"uint256","name":"tokenIdsLength","type":"uint256"}],"name":"ConsiderationTokenIdsDontMatchConsiderationLength","type":"error"},{"inputs":[],"name":"EtherTransferFailed","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"InvalidCaller","type":"error"},{"inputs":[],"name":"InvalidCampaignId","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"want","type":"uint256"}],"name":"InvalidConsiderationTokenIdSupplied","type":"error"},{"inputs":[],"name":"InvalidNativeOfferItem","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"want","type":"uint256"}],"name":"InvalidOfferLength","type":"error"},{"inputs":[],"name":"InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"internalType":"bytes32","name":"gotTraitValue","type":"bytes32"},{"internalType":"bytes32","name":"wantTraitValue","type":"bytes32"}],"name":"InvalidRequiredTraitValue","type":"error"},{"inputs":[],"name":"InvalidTime","type":"error"},{"inputs":[],"name":"InvalidTraitRedemption","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"InvalidTraitRedemptionToken","type":"error"},{"inputs":[{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"want","type":"uint256"}],"name":"InvalidTxValue","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"MaxCampaignRedemptionsReached","type":"error"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"MaxRedemptionsReached","type":"error"},{"inputs":[],"name":"NativeTransferFailed","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[{"internalType":"uint256","name":"itemIndex","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"name":"NonMatchingConsiderationItemAmounts","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentTimestamp","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"NotActive_","type":"error"},{"inputs":[],"name":"NotManager","type":"error"},{"inputs":[],"name":"NotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ProvenanceHashCannotBeSetAfterAlreadyBeingSet","type":"error"},{"inputs":[],"name":"RedemptionValuesAreImmutable","type":"error"},{"inputs":[],"name":"RequirementsIndexOutOfBounds","type":"error"},{"inputs":[],"name":"RoyaltyOverflow","type":"error"},{"inputs":[],"name":"RoyaltyReceiverIsZeroAddress","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[{"internalType":"uint256","name":"traitRedemptionsLength","type":"uint256"},{"internalType":"uint256","name":"tokenIdsLength","type":"uint256"}],"name":"TraitRedemptionTokenIdsDontMatchTraitRedemptionsLength","type":"error"},{"inputs":[],"name":"TraitValueUnchanged","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"isApproved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_toTokenId","type":"uint256"}],"name":"BatchMetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"campaignId","type":"uint256"},{"components":[{"components":[{"internalType":"uint32","name":"startTime","type":"uint32"},{"internalType":"uint32","name":"endTime","type":"uint32"},{"internalType":"uint32","name":"maxCampaignRedemptions","type":"uint32"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"signer","type":"address"}],"internalType":"struct CampaignParams","name":"params","type":"tuple"},{"components":[{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct OfferItem[]","name":"offer","type":"tuple[]"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct ConsiderationItem[]","name":"consideration","type":"tuple[]"},{"components":[{"internalType":"uint8","name":"substandard","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"internalType":"bytes32","name":"traitValue","type":"bytes32"},{"internalType":"bytes32","name":"substandardValue","type":"bytes32"}],"internalType":"struct TraitRedemption[]","name":"traitRedemptions","type":"tuple[]"}],"internalType":"struct CampaignRequirements[]","name":"requirements","type":"tuple[]"}],"indexed":false,"internalType":"struct Campaign","name":"campaign","type":"tuple"},{"indexed":false,"internalType":"string","name":"metadataURI","type":"string"}],"name":"CampaignUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"uri","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"bool","name":"approved","type":"bool"}],"name":"PreapprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"oldProvenanceHash","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newProvenanceHash","type":"bytes32"}],"name":"ProvenanceHashUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"campaignId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"requirementsIndex","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"redemptionHash","type":"bytes32"},{"indexed":false,"internalType":"uint256[]","name":"considerationTokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"traitRedemptionTokenIds","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"redeemedBy","type":"address"}],"name":"Redemption","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"basisPoints","type":"uint256"}],"name":"RoyaltyInfoUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"TraitMetadataURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"trait","type":"bytes32"}],"name":"TraitUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"indexed":false,"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"bytes32","name":"traitValue","type":"bytes32"}],"name":"TraitUpdatedBulkList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"traitValue","type":"bytes32"}],"name":"TraitUpdatedBulkRange","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint32","name":"startTime","type":"uint32"},{"internalType":"uint32","name":"endTime","type":"uint32"},{"internalType":"uint32","name":"maxCampaignRedemptions","type":"uint32"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"signer","type":"address"}],"internalType":"struct CampaignParams","name":"params","type":"tuple"},{"components":[{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct OfferItem[]","name":"offer","type":"tuple[]"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct ConsiderationItem[]","name":"consideration","type":"tuple[]"},{"components":[{"internalType":"uint8","name":"substandard","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"internalType":"bytes32","name":"traitValue","type":"bytes32"},{"internalType":"bytes32","name":"substandardValue","type":"bytes32"}],"internalType":"struct TraitRedemption[]","name":"traitRedemptions","type":"tuple[]"}],"internalType":"struct CampaignRequirements[]","name":"requirements","type":"tuple[]"}],"internalType":"struct Campaign","name":"campaign","type":"tuple"},{"internalType":"string","name":"metadataURI","type":"string"}],"name":"createCampaign","outputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"}],"name":"getCampaign","outputs":[{"components":[{"components":[{"internalType":"uint32","name":"startTime","type":"uint32"},{"internalType":"uint32","name":"endTime","type":"uint32"},{"internalType":"uint32","name":"maxCampaignRedemptions","type":"uint32"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"signer","type":"address"}],"internalType":"struct CampaignParams","name":"params","type":"tuple"},{"components":[{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct OfferItem[]","name":"offer","type":"tuple[]"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct ConsiderationItem[]","name":"consideration","type":"tuple[]"},{"components":[{"internalType":"uint8","name":"substandard","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"internalType":"bytes32","name":"traitValue","type":"bytes32"},{"internalType":"bytes32","name":"substandardValue","type":"bytes32"}],"internalType":"struct TraitRedemption[]","name":"traitRedemptions","type":"tuple[]"}],"internalType":"struct CampaignRequirements[]","name":"requirements","type":"tuple[]"}],"internalType":"struct Campaign","name":"campaign","type":"tuple"},{"internalType":"string","name":"metadataURI","type":"string"},{"internalType":"uint256","name":"totalRedemptions","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRedeemablesContracts","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTraitMetadataURI","outputs":[{"internalType":"string","name":"labelsURI","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32","name":"traitKey","type":"bytes32"}],"name":"getTraitValue","outputs":[{"internalType":"bytes32","name":"traitValue","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32[]","name":"traitKeys","type":"bytes32[]"}],"name":"getTraitValues","outputs":[{"internalType":"bytes32[]","name":"traitValues","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct OfferItem","name":"","type":"tuple"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct ConsiderationItem[]","name":"","type":"tuple[]"},{"components":[{"internalType":"uint8","name":"substandard","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"internalType":"bytes32","name":"traitValue","type":"bytes32"},{"internalType":"bytes32","name":"substandardValue","type":"bytes32"}],"internalType":"struct TraitRedemption[]","name":"","type":"tuple[]"}],"name":"mintRedemption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"provenanceHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"considerationTokenIds","type":"uint256[]"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"redeem","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"isApproved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint96","name":"feeNumerator","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newProvenanceHash","type":"bytes32"}],"name":"setProvenanceHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"redeemablesContracts","type":"address[]"}],"name":"setRedeemablesContracts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"internalType":"bytes32","name":"value","type":"bytes32"}],"name":"setTrait","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"},{"components":[{"components":[{"internalType":"uint32","name":"startTime","type":"uint32"},{"internalType":"uint32","name":"endTime","type":"uint32"},{"internalType":"uint32","name":"maxCampaignRedemptions","type":"uint32"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"address","name":"signer","type":"address"}],"internalType":"struct CampaignParams","name":"params","type":"tuple"},{"components":[{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct OfferItem[]","name":"offer","type":"tuple[]"},{"components":[{"internalType":"enum ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"}],"internalType":"struct ConsiderationItem[]","name":"consideration","type":"tuple[]"},{"components":[{"internalType":"uint8","name":"substandard","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"traitKey","type":"bytes32"},{"internalType":"bytes32","name":"traitValue","type":"bytes32"},{"internalType":"bytes32","name":"substandardValue","type":"bytes32"}],"internalType":"struct TraitRedemption[]","name":"traitRedemptions","type":"tuple[]"}],"internalType":"struct CampaignRequirements[]","name":"requirements","type":"tuple[]"}],"internalType":"struct Campaign","name":"campaign","type":"tuple"},{"internalType":"string","name":"metadataURI","type":"string"}],"name":"updateCampaign","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405260016009556001600e553480156200001b57600080fd5b506040518060600160405280602c81526020016200591f602c9139604080518082018252600581526442524e494560d81b602082015290518290829082908290600190731e0049783f008a0085193e00003d00cd54003c71907f48758afb8d66456bd71d7a30839977750a8933739d419fbedce30dee07b0db3790600090a36000620000a88382620001b0565b506001620000b78282620001b0565b50620000c333620000cf565b5050505050506200027c565b6001600160a01b0316638b78c6d8198190558060007f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200013657607f821691505b6020821081036200015757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620001ab57600081815260208120601f850160051c81016020861015620001865750805b601f850160051c820191505b81811015620001a75782815560010162000192565b5050505b505050565b81516001600160401b03811115620001cc57620001cc6200010b565b620001e481620001dd845462000121565b846200015d565b602080601f8311600181146200021c5760008415620002035750858301515b600019600386901b1c1916600185901b178555620001a7565b600085815260208120601f198616915b828110156200024d578886015182559484019460019091019084016200022c565b50858210156200026c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b615693806200028c6000396000f3fe6080604052600436106102bb5760003560e01c806370a082311161016e578063c6ab67a3116100cb578063e985e9c51161007f578063f2fde38b11610064578063f2fde38b146106fc578063f80ecba31461070f578063fee81cf41461073c57600080fd5b8063e985e9c5146106c9578063f04e283e146106e957600080fd5b8063c8c0619d116100b0578063c8c0619d1461067f578063de475bf91461069f578063e8a3d485146106b457600080fd5b8063c6ab67a314610649578063c87b56dd1461065f57600080fd5b806395d89b4111610122578063a28eec8711610107578063a28eec8714610603578063a5d7ebcf14610623578063b88d4fde1461063657600080fd5b806395d89b41146105ce578063a22cb465146105e357600080fd5b806381fe13c21161015357806381fe13c2146105755780638da5cb5b14610595578063938e3d7b146105ae57600080fd5b806370a082311461053f578063715018a61461056d57600080fd5b80632a55205a1161021c5780635598f8cc116101d05780636352211e116101b55780636352211e146104e8578063689cc677146105085780636c0360eb1461052a57600080fd5b80635598f8cc1461049957806355f804b3146104c857600080fd5b806342842e0e1161020157806342842e0e1461045e57806342966c681461047157806354d1f13d1461049157600080fd5b80632a55205a146103ff5780632bf453e31461043e57600080fd5b8063095ea7b3116102735780631172f13f116102585780631172f13f146103c457806323b872dd146103e457806325692962146103f757600080fd5b8063095ea7b314610391578063099b6bfa146103a457600080fd5b806304634d8d116102a457806304634d8d1461031757806306fdde0314610337578063081812fc1461035957600080fd5b806301ffc9a7146102c05780630302422f146102f5575b600080fd5b3480156102cc57600080fd5b506102e06102db3660046135bf565b61076f565b60405190151581526020015b60405180910390f35b34801561030157600080fd5b50610315610310366004613635565b6107b3565b005b34801561032357600080fd5b5061031561033236600461368c565b6107cc565b34801561034357600080fd5b5061034c610832565b6040516102ec9190613726565b34801561036557600080fd5b50610379610374366004613739565b6108c4565b6040516001600160a01b0390911681526020016102ec565b61031561039f366004613752565b610903565b3480156103b057600080fd5b506103156103bf366004613739565b610912565b3480156103d057600080fd5b506103156103df3660046137d8565b610990565b6103156103f2366004613848565b610aa2565b610315610ab6565b34801561040b57600080fd5b5061041f61041a366004613889565b610b06565b604080516001600160a01b0390931683526020830191909152016102ec565b34801561044a57600080fd5b506103156104593660046138ab565b610b5b565b61031561046c366004613848565b610bab565b34801561047d57600080fd5b5061031561048c366004613739565b610bd8565b610315610be5565b3480156104a557600080fd5b506104b96104b4366004613739565b610c21565b6040516102ec93929190613a14565b3480156104d457600080fd5b506103156104e3366004613b93565b611058565b3480156104f457600080fd5b50610379610503366004613739565b6110a6565b34801561051457600080fd5b5061051d6110e4565b6040516102ec9190613bc9565b34801561053657600080fd5b5061034c611145565b34801561054b57600080fd5b5061055f61055a366004613c16565b6111d3565b6040519081526020016102ec565b61031561120e565b34801561058157600080fd5b50610315610590366004613c78565b611222565b3480156105a157600080fd5b50638b78c6d81954610379565b3480156105ba57600080fd5b506103156105c9366004613b93565b611260565b3480156105da57600080fd5b5061034c6112a7565b3480156105ef57600080fd5b506103156105fe366004613d62565b6112b6565b34801561060f57600080fd5b5061055f61061e366004613889565b61132f565b610315610631366004613d90565b61138e565b610315610644366004613e15565b611724565b34801561065557600080fd5b5061055f60045481565b34801561066b57600080fd5b5061034c61067a366004613739565b61177f565b34801561068b57600080fd5b5061055f61069a366004613e77565b611808565b3480156106ab57600080fd5b5061034c611825565b3480156106c057600080fd5b5061034c611834565b3480156106d557600080fd5b506102e06106e4366004613ee0565b611841565b6103156106f7366004613c16565b611898565b61031561070a366004613c16565b6118d5565b34801561071b57600080fd5b5061072f61072a366004613f0e565b6118fc565b6040516102ec9190613f4d565b34801561074857600080fd5b5061055f610757366004613c16565b63389a75e1600c908152600091909152602090205490565b60006001600160e01b031982167f81fe13c20000000000000000000000000000000000000000000000000000000014806107ad57506107ad8261194e565b92915050565b6107bb611968565b6107c7600d838361353a565b505050565b6107d4611968565b6107de8282611983565b604080516001600160a01b03841681526bffffffffffffffffffffffff831660208201527ff21fccf4d64d86d532c4e4eb86c007b6ad57a460c27d724188625e755ec6cf6d91015b60405180910390a15050565b60606000805461084190613f85565b80601f016020809104026020016040519081016040528092919081815260200182805461086d90613f85565b80156108ba5780601f1061088f576101008083540402835291602001916108ba565b820191906000526020600020905b81548152906001019060200180831161089d57829003601f168201915b5050505050905090565b600081600052673ec412a9852d173d60c11b601c52602060002082018201805460601b6108f95763ceea21b66000526004601cfd5b6001015492915050565b61090e3383836119d3565b5050565b61091a611968565b6004548015610955576040517f2858c21800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600482905560408051828152602081018490527f7c22004198bf87da0f0dab623c72e66ca1200f4454aa3b9ca30f436275428b7c9101610826565b83158061099f57506009548410155b156109bd57604051636824bccd60e01b815260040160405180910390fd5b6000848152600a60205260409020546c0100000000000000000000000090046001600160a01b0316338114610a1e576040517fc0fc8a8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a2f610a2a8561442d565b611a74565b6000858152600a602052604090208490610a498282614baf565b50508115610a6057600b610a5e838583614d13565b505b847f79ff3f429db28adc780ec19c3110c1dcfde05728a9c19578b1ec27ee3c93ddcd85600b604051610a9392919061515b565b60405180910390a25050505050565b6107c7610aae84611c24565b848484611c7f565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b600082815268aa4ec00224afccfdb76020526040812054606081901c91906127109083610b3a576020515490508060601c93505b606084901b1884600019829004811182023d3d3e9396930204935090915050565b610b63611968565b6000838152673ec412a9852d173d60c11b601c5260209020830183015460601b610ba05760405163677510db60e11b815260040160405180910390fd5b6107c7838383611daa565b610bb6838383610aa2565b813b156107c7576107c783838360405180602001604052806000815250611e64565b610be23382611ef1565b50565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b6040805160e081018252600091810182815260608083018490526080830184905260a0830184905260c08301849052908252602082018190529091831580610c6b57506009548410155b15610c8957604051636824bccd60e01b815260040160405180910390fd5b6000848152600a60209081526040808320815160e081018352815463ffffffff80821683860190815264010000000083048216606085015268010000000000000000830490911660808401526c010000000000000000000000009091046001600160a01b0390811660a084015260018401541660c083015281526002820180548451818702810187019095528085529195929486810194939192919084015b82821015610fac578382906000526020600020906003020160405180606001604052908160008201805480602002602001604051908101604052809291908181526020016000905b82821015610e1c576000848152602090206040805160a08101909152600484029091018054829060ff166005811115610dab57610dab6138d7565b6005811115610dbc57610dbc6138d7565b81526020016000820160019054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152602001600182015481526020016002820154815260200160038201548152505081526020019060010190610d70565b50505050815260200160018201805480602002602001604051908101604052809291908181526020016000905b82821015610efd57838290600052602060002090600502016040518060c00160405290816000820160009054906101000a900460ff166005811115610e9057610e906138d7565b6005811115610ea157610ea16138d7565b815281546001600160a01b0361010090910481166020808401919091526001808501546040850152600285015460608501526003850154608085015260049094015490911660a090920191909152918352929092019101610e49565b50505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b82821015610f955760008481526020908190206040805160a08101825260048602909201805460ff8116845261010090046001600160a01b03168385015260018082015492840192909252600281015460608401526003015460808301529083529092019101610f2a565b505050508152505081526020019060010190610d28565b50505050815250509250600b8054610fc390613f85565b80601f0160208091040260200160405190810160405280929190818152602001828054610fef90613f85565b801561103c5780601f106110115761010080835404028352916020019161103c565b820191906000526020600020905b81548152906001019060200180831161101f57829003601f168201915b50505060009687525050600c6020526040909420549294915050565b611060611968565b600261106d828483614d13565b50604080516000815260001960208201527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c9101610826565b6000818152673ec412a9852d173d60c11b601c526020902081018101546001600160a01b0316806110df5763ceea21b66000526004601cfd5b919050565b6060600d8054806020026020016040519081016040528092919081815260200182805480156108ba57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161111e575050505050905090565b6002805461115290613f85565b80601f016020809104026020016040519081016040528092919081815260200182805461117e90613f85565b80156111cb5780601f106111a0576101008083540402835291602001916111cb565b820191906000526020600020905b8154815290600101906020018083116111ae57829003601f168201915b505050505081565b6000816111e857638f4eb6046000526004601cfd5b673ec412a9852d173d60c11b601c528160005263ffffffff601c600c2054169050919050565b611216611968565b6112206000611fcb565b565b61122a612009565b600e6000815461123990615219565b90915550600e5461125790879061125290600190615232565b61209f565b50505050505050565b611268611968565b6003611275828483614d13565b507f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac373788282604051610826929190615245565b60606001805461084190613f85565b8015159050731e0049783f008a0085193e00003d00cd54003c718214818115168215821617905082601c52670a5a2e7a0000000060085233600052806030600c205550806000528160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206000a35050565b6000828152673ec412a9852d173d60c11b601c5260208120830183015460601b61136c5760405163677510db60e11b815260040160405180910390fd5b60008381526007602090815260408083208584529091529020545b9392505050565b6001600160a01b0383166113a0573392505b600080806113b0848601866152e4565b50506000848152600a6020526040902060028101549497509295509350909184109050611409576040517f13d59cc100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114138482612159565b6116d48482600201858154811061142c5761142c6153c4565b906000526020600020906003020160405180606001604052908160008201805480602002602001604051908101604052809291908181526020016000905b82821015611516576000848152602090206040805160a08101909152600484029091018054829060ff1660058111156114a5576114a56138d7565b60058111156114b6576114b66138d7565b81526020016000820160019054906101000a90046001600160a01b03166001600160a01b03166001600160a01b0316815260200160018201548152602001600282015481526020016003820154815250508152602001906001019061146a565b50505050815260200160018201805480602002602001604051908101604052809291908181526020016000905b828210156115f757838290600052602060002090600502016040518060c00160405290816000820160009054906101000a900460ff16600581111561158a5761158a6138d7565b600581111561159b5761159b6138d7565b815281546001600160a01b0361010090910481166020808401919091526001808501546040850152600285015460608501526003850154608085015260049094015490911660a090920191909152918352929092019101611543565b50505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b8282101561168f5760008481526020908190206040805160a08101825260048602909201805460ff8116845261010090046001600160a01b03168385015260018082015492840192909252600281015460608401526003015460808301529083529092019101611624565b50505050815250508b8b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508892508d915061226b9050565b837f15774c935df2fa5080dc5a607a78c8c34254853dfb71bf38b28d5ff119533926846000801b8c8c8733604051611711969594939291906153da565b60405180910390a2505050505050505050565b61172f858585610aa2565b833b156117785761177885858585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e6492505050565b5050505050565b60606117a9826000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b6117c65760405163677510db60e11b815260040160405180910390fd5b6000828152600f602052604090205460026117e0826122de565b6040516020016117f1929190615494565b604051602081830303815290604052915050919050565b6000611812611968565b61181d848484612322565b949350505050565b60606008805461084190613f85565b6003805461115290613f85565b6000806118648484601c52670a5a2e7a000000006008526000526030600c205490565b90506001600160a01b038316731e0049783f008a0085193e00003d00cd54003c7114611890578061181d565b159392505050565b6118a0611968565b63389a75e1600c52806000526020600c2080544211156118c857636f5e88186000526004601cfd5b60009055610be281611fcb565b6118dd611968565b8060601b6118f357637448fbae6000526004601cfd5b610be281611fcb565b6060611926846000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b6119435760405163677510db60e11b815260040160405180910390fd5b61181d8484846123b8565b600061195982612461565b806107ad57506107ad826124ab565b638b78c6d819543314611220576382b429006000526004601cfd5b6bffffffffffffffffffffffff16612710808211156119aa5763350a88b36000526004601cfd5b8260601b806119c15763b4457eaa6000526004601cfd5b90911768aa4ec00224afccfdb7555050565b60001960601c828116925083811693508160005283673ec412a9852d173d60c11b17601c5260206000208201820180548216915081611a1a5763ceea21b66000526004601cfd5b818514851517611a4057816000526030600c2054611a4057634b6e7f186000526004601cfd5b6001018390558183827f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a450505050565b80516020810151905163ffffffff91821691161115611abf576040517f6f7eac2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b81602001515181101561090e57600082602001518281518110611ae757611ae76153c4565b6020026020010151905060005b816020015151811015611c1a57600082602001518281518110611b1957611b196153c4565b6020026020010151905060006001600160a01b03168160a001516001600160a01b031603611b73576040517ff821dcf500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060600151600003611bb1576040517f288c10c500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060800151816060015114611c1157606081015160808201516040517fe924c25e00000000000000000000000000000000000000000000000000000000815260048101879052602481019290925260448201526064015b60405180910390fd5b50600101611af4565b5050600101611ac2565b60007fffffffffffffffffffffffffe1ffb687c0ff75ff7ae6c1ffffc2ff32abffc38f3301611c7857611c6b82731e0049783f008a0085193e00003d00cd54003c71611841565b15611c7857506000919050565b5033919050565b611c8a838383612547565b60008181526001600160a01b03948516673ec412a9852d173d60c11b8117601c526020909120820182018054919594851694938416938216918286148302611ced5782611cdf5763ceea21b66000526004601cfd5b63a11481006000526004601cfd5b84611d005763ea553b346000526004601cfd5b856000528160010154925082871486881417871517611d31576030600c2054611d3157634b6e7f186000526004601cfd5b8215611d3f57600082600101555b85851818905550601c600c8181208054600019019055600084905220805460010163ffffffff8116611d79576301336cea6000526004601cfd5b90558082847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a45b50505050565b6000838152600760209081526040808320858452909152902054818103611dfd576040517fc37ca37500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611e086005846125dd565b506000848152600760209081526040808320868452825291829020849055815186815290810184905284917f8386f3b08e49490d0c5a9d2c401c091f13b01a17d75ce4a2f0f8f923b410ff7d910160405180910390a250505050565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a08401528015611eab578060c08401826020870160045afa505b60208360a48301601c860160008a5af1611ecf573d15611ecf573d6000803e3d6000fd5b508060e01b825114611ee95763d1a57ed66000526004601cfd5b505050505050565b6000611efc826110a6565b9050611f0a81600084612547565b5060008181526001600160a01b03928316673ec412a9852d173d60c11b8117601c526020909120820182018054919382169182611f4f5763ceea21b66000526004601cfd5b82600052816001015480861484871417861517611f7e576030600c2054611f7e57634b6e7f186000526004601cfd5b8015611f8c57600083600101555b5082189055601c600c208054600019019055816000827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4505050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b30330361201257565b6000805b600d5481101561206557600d8181548110612033576120336153c4565b6000918252602090912001546001600160a01b0316330361205357600191505b8061205d81615219565b915050612016565b5080610be2576040517fcbd9d2e0000000000000000000000000000000000000000000000000000000008152336004820152602401611c08565b6120ab60008383612547565b6001600160a01b0390911690816120ca5763ea553b346000526004601cfd5b80600052673ec412a9852d173d60c11b601c5260206000208101810180548060601b156120ff5763c991cbb16000526004601cfd5b831790556000829052601c600c20805460010163ffffffff811661212b576301336cea6000526004601cfd5b9055808260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a45050565b80544263ffffffff808316821064010000000090930416111517156121cc5780546040517f2b0d2d0700000000000000000000000000000000000000000000000000000000815242600482015263ffffffff80831660248301526401000000009092049091166044820152606401611c08565b80546000838152600c60205260409020546801000000000000000090910463ffffffff16906121fc90600161551b565b111561090e576000828152600c602052604090205461221c90600161551b565b81546040517f3243f3b2000000000000000000000000000000000000000000000000000000008152600481019290925268010000000000000000900463ffffffff166024820152604401611c08565b6000858152600c60205260408120805490919061228790615219565b90915550604084015151156122a4576122a48460400151836125e9565b602084015151156122bd576122bd84602001518461263b565b835151156117785761177885856020015186600001518760400151856129de565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806122f85750819003601f19909101908152919050565b6000612330610a2a8561442d565b506009805490600061234183615219565b909155506000818152600a60205260409020849061235f8282614baf565b5050811561237657600b612374838583614d13565b505b807f79ff3f429db28adc780ec19c3110c1dcfde05728a9c19578b1ec27ee3c93ddcd85600b6040516123a992919061515b565b60405180910390a29392505050565b6060818067ffffffffffffffff8111156123d4576123d4613fb9565b6040519080825280602002602001820160405280156123fd578160200160208202803683370190505b50915060005b8181101561245857600085858381811061241f5761241f6153c4565b905060200201359050612432878261132f565b848381518110612444576124446153c4565b602090810291909101015250600101612403565b50509392505050565b6000612489826301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b806107ad5750632a55205a60e083901c9081146301ffc9a791909114176107ad565b60006001600160e01b031982167f29fd83a100000000000000000000000000000000000000000000000000000000148061250e57506001600160e01b031982167f01ffc9a700000000000000000000000000000000000000000000000000000000145b806107ad57506001600160e01b031982167faf332f3e000000000000000000000000000000000000000000000000000000001492915050565b6001600160a01b0383166107c757600060644460405160200161256c91815260200190565b6040516020818303038152906040528051906020012060001c61258f919061552e565b61259a90600161551b565b90506001603c82108015906125af5750605a82105b156125bc575060026125c8565b605a82106125c8575060035b6000838152600f602052604090205550505050565b60006113878383612a7e565b805182511461263157815181516040517fa722fb5c00000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401611c08565b61090e8282612acd565b805182511461268357815181516040517fdd24e43e00000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401611c08565b6000805b835181101561299b5760008482815181106126a4576126a46153c4565b6020026020010151905060008483815181106126c2576126c26153c4565b602002602001015190506000600260058111156126e1576126e16138d7565b835160058111156126f4576126f46138d7565b14806127125750600483516005811115612710576127106138d7565b145b156127c15760208301516040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905233916001600160a01b031690636352211e90602401602060405180830381865afa15801561277b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279f9190615550565b6001600160a01b0316146127b45760006127b7565b60015b60ff169050612904565b6003835160058111156127d6576127d66138d7565b14806127f457506005835160058111156127f2576127f26138d7565b145b1561288d5760208301516040517efdd58e000000000000000000000000000000000000000000000000000000008152336004820152602481018490526001600160a01b039091169062fdd58e906044015b602060405180830381865afa158015612862573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612886919061556d565b9050612904565b6001835160058111156128a2576128a26138d7565b036128f25760208301516040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03909116906370a0823190602401612845565b6060830151612901908661551b565b94505b600083516005811115612919576129196138d7565b1415801561292a5750826060015181105b1561298357602083015160608401516040517f400fb4920000000000000000000000000000000000000000000000000000000081526001600160a01b039092166004830152602482018390526044820152606401611c08565b61298d8284612ec1565b836001019350505050612687565b508034146107c7576040517ffde0d3d800000000000000000000000000000000000000000000000000000000815234600482015260248101829052604401611c08565b60005b8351811015611ee95760008482815181106129fe576129fe6153c4565b6020026020010151905080602001516001600160a01b03166381fe13c28885848a896040518663ffffffff1660e01b8152600401612a40959493929190615586565b600060405180830381600087803b158015612a5a57600080fd5b505af1158015612a6e573d6000803e3d6000fd5b50505050816001019150506129e1565b6000818152600183016020526040812054612ac5575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107ad565b5060006107ad565b60005b82518110156107c7576000828281518110612aed57612aed6153c4565b602002602001015190506000848381518110612b0b57612b0b6153c4565b60200260200101516000015190506000858481518110612b2d57612b2d6153c4565b60200260200101516080015190506000868581518110612b4f57612b4f6153c4565b60200260200101516020015190506000878681518110612b7157612b716153c4565b60200260200101516040015190506000888781518110612b9357612b936153c4565b60200260200101516060015190506000836001600160a01b031663a28eec8788856040518363ffffffff1660e01b8152600401612bda929190918252602082015260400190565b602060405180830381865afa158015612bf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1b919061556d565b90508560ff16600103612d0457848114612c6f576040516337e0269160e01b81526001600160a01b03851660048201526024810188905260448101849052606481018290526084810186905260a401611c08565b836001600160a01b0316632bf453e3888c8b81518110612c9157612c916153c4565b602002602001015160400151856040518463ffffffff1660e01b8152600401612ccd939291909283526020830191909152604082015260600190565b600060405180830381600087803b158015612ce757600080fd5b505af1158015612cfb573d6000803e3d6000fd5b50505050612eaf565b8560ff16600203612dfe5784811115612d57576040516337e0269160e01b81526001600160a01b03851660048201526024810188905260448101849052606481018290526084810186905260a401611c08565b6000612d63838361551b565b9050846001600160a01b0316632bf453e3898d8c81518110612d8757612d876153c4565b6020026020010151604001518460001b6040518463ffffffff1660e01b8152600401612dc6939291909283526020830191909152604082015260600190565b600060405180830381600087803b158015612de057600080fd5b505af1158015612df4573d6000803e3d6000fd5b5050505050612eaf565b8560ff16600303612e5d5784811015612e51576040516337e0269160e01b81526001600160a01b03851660048201526024810188905260448101849052606481018290526084810186905260a401611c08565b6000612d638383615232565b8560ff16600403612eaf57818114612eaf576040516337e0269160e01b81526001600160a01b03851660048201526024810188905260448101849052606481018290526084810186905260a401611c08565b50505050505081600101915050612ad0565b80604001518214158015612ed85750604081015115155b8015612f145750600481516005811115612ef457612ef46138d7565b141580612f145750600581516005811115612f1157612f116138d7565b14155b15612f6d57602081015160408083015190517f027bbdb40000000000000000000000000000000000000000000000000000000081526001600160a01b039092166004830152602482018490526044820152606401611c08565b60208101516001600160a01b031630148015612f97575060a08101516001600160a01b031661dead145b8015612fa1575060015b15612fb55761090e3383836060015161352b565b600281516005811115612fca57612fca6138d7565b1480612fe85750600481516005811115612fe657612fe66138d7565b145b1561314b5761dead6001600160a01b03168160a001516001600160a01b0316036130f15760208101516040517f42966c68000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561306d57600080fd5b505af192505050801561307e575060015b61090e57602081015160a0820151604051632142170760e11b81523360048201526001600160a01b039182166024820152604481018590529116906342842e0e906064015b600060405180830381600087803b1580156130dd57600080fd5b505af1158015611ee9573d6000803e3d6000fd5b602081015160a0820151604051632142170760e11b81523360048201526001600160a01b039182166024820152604481018590529116906342842e0e90606401600060405180830381600087803b1580156130dd57600080fd5b600381516005811115613160576131606138d7565b148061317e575060058151600581111561317c5761317c6138d7565b145b156132f15761dead6001600160a01b03168160a001516001600160a01b03160361328e57602081015160608201516040517ff5298aca0000000000000000000000000000000000000000000000000000000081523360048201526024810185905260448101919091526001600160a01b039091169063f5298aca90606401600060405180830381600087803b15801561321657600080fd5b505af1925050508015613227575060015b61090e57602081015160a0808301516060840151604051637921219560e11b81523360048201526001600160a01b0392831660248201526044810187905260648101919091526084810192909252600060a48301529091169063f242432a9060c4016130c3565b602081015160a0808301516060840151604051637921219560e11b81523360048201526001600160a01b0392831660248201526044810187905260648101919091526084810192909252600060a48301529091169063f242432a9060c4016130c3565b600181516005811115613306576133066138d7565b0361349a5761dead6001600160a01b03168160a001516001600160a01b03160361343557602081015160608201516040517f79cc679000000000000000000000000000000000000000000000000000000000815233600482015260248101919091526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561339757600080fd5b505af19250505080156133a8575060015b61090e57602081015160a082015160608301516040516323b872dd60e01b81523360048201526001600160a01b03928316602482015260448101919091529116906323b872dd906064016020604051808303816000875af1158015613411573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c79190615669565b602081015160a082015160608301516040516323b872dd60e01b81523360048201526001600160a01b03928316602482015260448101919091529116906323b872dd906064016020604051808303816000875af1158015613411573d6000803e3d6000fd5b60008160a001516001600160a01b03163460405160006040518083038185875af1925050503d80600081146134eb576040519150601f19603f3d011682016040523d82523d6000602084013e6134f0565b606091505b50509050806107c7576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107c782610be2600082611ef1565b82805482825590600052602060002090810192821561359a579160200282015b8281111561359a57815473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384351617825560209092019160019091019061355a565b506135a69291506135aa565b5090565b5b808211156135a657600081556001016135ab565b6000602082840312156135d157600080fd5b81356001600160e01b03198116811461138757600080fd5b60008083601f8401126135fb57600080fd5b50813567ffffffffffffffff81111561361357600080fd5b6020830191508360208260051b850101111561362e57600080fd5b9250929050565b6000806020838503121561364857600080fd5b823567ffffffffffffffff81111561365f57600080fd5b61366b858286016135e9565b90969095509350505050565b6001600160a01b0381168114610be257600080fd5b6000806040838503121561369f57600080fd5b82356136aa81613677565b915060208301356bffffffffffffffffffffffff811681146136cb57600080fd5b809150509250929050565b60005b838110156136f15781810151838201526020016136d9565b50506000910152565b600081518084526137128160208601602086016136d6565b601f01601f19169290920160200192915050565b60208152600061138760208301846136fa565b60006020828403121561374b57600080fd5b5035919050565b6000806040838503121561376557600080fd5b823561377081613677565b946020939093013593505050565b600060c0828403121561379057600080fd5b50919050565b60008083601f8401126137a857600080fd5b50813567ffffffffffffffff8111156137c057600080fd5b60208301915083602082850101111561362e57600080fd5b600080600080606085870312156137ee57600080fd5b84359350602085013567ffffffffffffffff8082111561380d57600080fd5b6138198883890161377e565b9450604087013591508082111561382f57600080fd5b5061383c87828801613796565b95989497509550505050565b60008060006060848603121561385d57600080fd5b833561386881613677565b9250602084013561387881613677565b929592945050506040919091013590565b6000806040838503121561389c57600080fd5b50508035926020909101359150565b6000806000606084860312156138c057600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052602160045260246000fd5b6006811061390b57634e487b7160e01b600052602160045260246000fd5b9052565b61391a8282516138ed565b6001600160a01b0360208201511660208301526040810151604083015260608101516060830152608081015160808301525050565b61395a8282516138ed565b6020818101516001600160a01b039081169184019190915260408083015190840152606080830151908401526080808301519084015260a091820151169082015260c00190565b600081518084526020808501945080840160005b83811015613a09578151805160ff1688526020808201516001600160a01b03169089015260408082015190890152606080820151908901526080908101519088015260a087019650908201906001016139b5565b509495945050505050565b600060608083526101208301865163ffffffff80825116848701526020808301516080838216818a0152604091508185015160a0858216818c01528887015195506001600160a01b03915081861660c08c015281838801511660e08c0152848e0151965060c06101008c0152879550865191508188526101409750878b019550878260051b8c01019750848701965060005b82811015613b6b578b890361013f19018752875180518b8b5280518c8c0181905290880190600090878d01905b80831015613afa57613ae682855161390f565b928a01926001929092019190860190613ad3565b50838a01518d82038e8c01528051808352908b019350908a0191506000905b80821015613b3e57613b2c83855161394f565b92508a84019350600182019150613b19565b5050918701518b83038c89015291613b5681846139a1565b9b505050978601975095850195600101613aa6565b5050505087850382890152613b80858b6136fa565b9701979097525093979650505050505050565b60008060208385031215613ba657600080fd5b823567ffffffffffffffff811115613bbd57600080fd5b61366b85828601613796565b6020808252825182820181905260009190848201906040850190845b81811015613c0a5783516001600160a01b031683529284019291840191600101613be5565b50909695505050505050565b600060208284031215613c2857600080fd5b813561138781613677565b60008083601f840112613c4557600080fd5b50813567ffffffffffffffff811115613c5d57600080fd5b60208301915083602060a08302850101111561362e57600080fd5b6000806000806000806000878903610120811215613c9557600080fd5b883597506020890135613ca781613677565b965060a0603f1982011215613cbb57600080fd5b5060408801945060e088013567ffffffffffffffff80821115613cdd57600080fd5b818a0191508a601f830112613cf157600080fd5b813581811115613d0057600080fd5b8b602060c083028501011115613d1557600080fd5b602083019650809550506101008a0135915080821115613d3457600080fd5b50613d418a828b01613c33565b989b979a50959850939692959293505050565b8015158114610be257600080fd5b60008060408385031215613d7557600080fd5b8235613d8081613677565b915060208301356136cb81613d54565b600080600080600060608688031215613da857600080fd5b853567ffffffffffffffff80821115613dc057600080fd5b613dcc89838a016135e9565b909750955060208801359150613de182613677565b90935060408701359080821115613df757600080fd5b50613e0488828901613796565b969995985093965092949392505050565b600080600080600060808688031215613e2d57600080fd5b8535613e3881613677565b94506020860135613e4881613677565b935060408601359250606086013567ffffffffffffffff811115613e6b57600080fd5b613e0488828901613796565b600080600060408486031215613e8c57600080fd5b833567ffffffffffffffff80821115613ea457600080fd5b613eb08783880161377e565b94506020860135915080821115613ec657600080fd5b50613ed386828701613796565b9497909650939450505050565b60008060408385031215613ef357600080fd5b8235613efe81613677565b915060208301356136cb81613677565b600080600060408486031215613f2357600080fd5b83359250602084013567ffffffffffffffff811115613f4157600080fd5b613ed3868287016135e9565b6020808252825182820181905260009190848201906040850190845b81811015613c0a57835183529284019291840191600101613f69565b600181811c90821680613f9957607f821691505b60208210810361379057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613ff257613ff2613fb9565b60405290565b60405160a0810167ffffffffffffffff81118282101715613ff257613ff2613fb9565b6040516060810167ffffffffffffffff81118282101715613ff257613ff2613fb9565b6040805190810167ffffffffffffffff81118282101715613ff257613ff2613fb9565b604051601f8201601f1916810167ffffffffffffffff8111828210171561408a5761408a613fb9565b604052919050565b63ffffffff81168114610be257600080fd5b600067ffffffffffffffff8211156140be576140be613fb9565b5060051b60200190565b60068110610be257600080fd5b600082601f8301126140e657600080fd5b813560206140fb6140f6836140a4565b614061565b82815260c0928302850182019282820191908785111561411a57600080fd5b8387015b8581101561419a5781818a0312156141365760008081fd5b61413e613fcf565b8135614149816140c8565b81528186013561415881613677565b8187015260408281013590820152606080830135908201526080808301359082015260a08083013561418981613677565b90820152845292840192810161411e565b5090979650505050505050565b60ff81168114610be257600080fd5b600082601f8301126141c757600080fd5b813560206141d76140f6836140a4565b82815260a092830285018201928282019190878511156141f657600080fd5b8387015b8581101561419a5781818a0312156142125760008081fd5b61421a613ff8565b8135614225816141a7565b81528186013561423481613677565b8187015260408281013590820152606080830135908201526080808301359082015284529284019281016141fa565b600082601f83011261427457600080fd5b6142816140f683356140a4565b82358082526020808301929160051b850101858111156142a057600080fd5b602085015b818110156144225767ffffffffffffffff80823511156142c457600080fd5b813587016060818a03601f190112156142dc57600080fd5b6142e461401b565b82602083013511156142f557600080fd5b602082013582018a603f82011261430b57600080fd5b602081013561431c6140f6826140a4565b81815260a090910282016040019060208101908d83111561433c57600080fd5b6040840193505b828410156143bb5760a0848f03121561435b57600080fd5b614363613ff8565b61436d85356140c8565b8435815261437e6020860135613677565b602085013560208201526040850135604082015260608501356060820152608085013560808201528083525060208201915060a084019350614343565b845250505060408201358310156143d157600080fd5b6143e48a602060408501358501016140d5565b602082015282606083013511156143fa57600080fd5b61440d8a602060608501358501016141b6565b604082015286525050602093840193016142a5565b509095945050505050565b600081360360c081121561444057600080fd5b61444861403e565b60a082121561445657600080fd5b61445e613ff8565b9150833561446b81614092565b8252602084013561447b81614092565b6020830152604084013561448e81614092565b604083015260608401356144a181613677565b606083015260808401356144b481613677565b608083015290815260a08301359067ffffffffffffffff8211156144d757600080fd5b6144e336838601614263565b60208201529392505050565b600081356107ad81613677565b6000808335601e1984360301811261451357600080fd5b83018035915067ffffffffffffffff82111561452e57600080fd5b6020019150600581901b360382131561362e57600080fd5b60008235605e1983360301811261455c57600080fd5b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8054600080835581156107c75760027f3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831683146145bc576145bc614566565b8382526020822083821b81015b80821015611ee95783825583600183015583838301558360038301556004820191506145c9565b6801000000000000000082111561460957614609613fb9565b8054828255808310156107c75760027f3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808316831461464a5761464a614566565b808516851461465b5761465b614566565b5060008381526020812085831b81019084841b015b80821015611257578282558260018301558284830155826003830155600482019150614670565b8054600080835581156107c757600582810281810484146146ba576146ba614566565b84835260208320908101905b81811015611ee95783815583600182015583600282015583600382015583600482015582810190506146c6565b6801000000000000000082111561470c5761470c613fb9565b8054828255808310156107c7576005818102818104831461472f5761472f614566565b848202828104861461474357614743614566565b6000858152602081209283019291909101905b82821015611257578082558060018301558060028301558060038301558060048301558382019150614756565b6000808335601e1984360301811261479a57600080fd5b83018035915067ffffffffffffffff8211156147b557600080fd5b602001915060a08102360382131561362e57600080fd5b600682106147ea57634e487b7160e01b600052602160045260246000fd5b60ff1981541660ff831681178255505050565b6000808335601e1984360301811261481457600080fd5b83018035915067ffffffffffffffff82111561482f57600080fd5b602001915060c08102360382131561362e57600080fd5b61485083826146f3565b818160005260208060002060005b86811015611257578335614871816140c8565b61487b81846147cc565b508284013561488981613677565b825474ffffffffffffffffffffffffffffffffffffffff001916600882901b74ffffffffffffffffffffffffffffffffffffffff00161783555060408401356001830155606084013560028301556080840135600383015560a08401356148ef81613677565b60048301805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383161790555060c093909301926005919091019060010161485e565b61493a83826145f0565b818160005260208060002060005b8681101561125757833561495b816141a7565b60ff811660ff19845416178355508284013561497681613677565b825474ffffffffffffffffffffffffffffffffffffffff001916600882901b74ffffffffffffffffffffffffffffffffffffffff00161783555060408401356001830155606084013560028301556080840135600383015560a084019350600482019150600181019050614948565b6149ef8283614783565b6149f981846145f0565b8260005260208060002060005b83811015614aa0578435614a19816140c8565b614a2381846147cc565b5082850135614a3181613677565b825474ffffffffffffffffffffffffffffffffffffffff001916600882901b74ffffffffffffffffffffffffffffffffffffffff00161783555060408501356001830155606085013560028301556080850135600383015560a085019450600482019150600181019050614a06565b5050614aae818601866147fd565b9350915050614ac1828260018601614846565b5050614ad06040830183614783565b611da4818360028601614930565b68010000000000000000831115614af757614af7613fb9565b805483825580841015614b715760038181028181048314614b1a57614b1a614566565b8582028281048714614b2e57614b2e614566565b60008581526020902091820191015b81811015614b6d57614b4e8161457c565b614b5a60018201614697565b614b666002820161457c565b8201614b3d565b5050505b5060008181526020812083915b85811015611ee957614b99614b938487614546565b836149e5565b6020929092019160039190910190600101614b7e565b8135614bba81614092565b63ffffffff8116905081548163ffffffff1982161783556020840135614bdf81614092565b67ffffffff000000008160201b169050808367ffffffffffffffff198416171784556040850135614c0f81614092565b6bffffffff00000000000000008160401b16846bffffffffffffffffffffffff19851617831717855550505050614c75614c4b606084016144ef565b82546bffffffffffffffffffffffff1660609190911b6bffffffffffffffffffffffff1916178255565b614cb2614c84608084016144ef565b600183016001600160a01b03821673ffffffffffffffffffffffffffffffffffffffff198254161781555050565b614cbf60a08301836144fc565b611da4818360028601614ade565b601f8211156107c757600081815260208120601f850160051c81016020861015614cf45750805b601f850160051c820191505b81811015611ee957828155600101614d00565b67ffffffffffffffff831115614d2b57614d2b613fb9565b614d3f83614d398354613f85565b83614ccd565b6000601f841160018114614d735760008515614d5b5750838201355b600019600387901b1c1916600186901b178355611778565b600083815260209020601f19861690835b82811015614da45786850135825560209485019460019092019101614d84565b5086821015614dc15760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6000808335601e19843603018112614dea57600080fd5b830160208101925035905067ffffffffffffffff811115614e0a57600080fd5b8060051b360382131561362e57600080fd5b6000808335601e19843603018112614e3357600080fd5b830160208101925035905067ffffffffffffffff811115614e5357600080fd5b60a08102360382131561362e57600080fd5b6000808335601e19843603018112614e7c57600080fd5b830160208101925035905067ffffffffffffffff811115614e9c57600080fd5b60c08102360382131561362e57600080fd5b8183526000602080850194508260005b85811015613a09578135614ed1816140c8565b614edb88826138ed565b5082820135614ee981613677565b6001600160a01b039081168885015260408381013590890152606080840135908901526080808401359089015260a09081840135614f2681613677565b169088015260c0968701969190910190600101614ebe565b8183526000602080850194508260005b85811015613a09578135614f61816141a7565b60ff16875281830135614f7381613677565b6001600160a01b03168784015260408281013590880152606080830135908801526080808301359088015260a09687019690910190600101614f4e565b81835260006020808501808196508560051b810191508460005b878110156150d15782840389528135605e19883603018112614feb57600080fd5b87016060858101614ffc8380614e1c565b8389529182905260809182890160005b8281101561507057833561501f816140c8565b61502983826138ed565b508b84013561503781613677565b6001600160a01b0316828d0152604084810135908301528584013586830152848401358583015260a0938401939091019060010161500c565b5061507d8b870187614e65565b955093508981038b8b0152615093818686614eae565b94505050505060406150a781840184614e1c565b9350878303828901526150bb838583614f3e565b9c89019c97505050928601925050600101614fca565b5091979650505050505050565b600081546150eb81613f85565b808552602060018381168015615108576001811461512257615150565b60ff1985168884015283151560051b880183019550615150565b866000528260002060005b858110156151485781548a820186015290830190840161512d565b890184019650505b505050505092915050565b604081526000833561516c81614092565b63ffffffff908116604084015260208501359061518882614092565b908116606084015260408501359061519f82614092565b16608083015260608401356151b381613677565b6001600160a01b0390811660a08401526080850135906151d282613677565b1660c08301526151e560a0850185614dd3565b60c060e08501526151fb61010085018284614fb0565b915050828103602084015261521081856150de565b95945050505050565b60006001820161522b5761522b614566565b5060010190565b818103818111156107ad576107ad614566565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b600082601f83011261528557600080fd5b813567ffffffffffffffff81111561529f5761529f613fb9565b6152b2601f8201601f1916602001614061565b8181528460208386010111156152c757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c087890312156152fd57600080fd5b86359550602080880135955060408801359450606088013567ffffffffffffffff8082111561532b57600080fd5b818a0191508a601f83011261533f57600080fd5b813561534d6140f6826140a4565b81815260059190911b8301840190848101908d83111561536c57600080fd5b938501935b8285101561538a57843582529385019390850190615371565b9750505060808a0135945060a08a01359250808311156153a957600080fd5b50506153b789828a01615274565b9150509295509295509295565b634e487b7160e01b600052603260045260246000fd5b86815260006020878184015260a060408401528560a08401527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff86111561542057600080fd5b8560051b808860c086013760c09084018481038201606086015286519181018290528287019160009160e001905b8083101561546e578351825292840192600192909201919084019061544e565b506001600160a01b0387166080870152935061548992505050565b979650505050505050565b60008084546154a281613f85565b600182811680156154ba57600181146154cf576154fe565b60ff19841687528215158302870194506154fe565b8860005260208060002060005b858110156154f55781548a8201529084019082016154dc565b50505082870194505b5050505083516155128183602088016136d6565b01949350505050565b808201808211156107ad576107ad614566565b60008261554b57634e487b7160e01b600052601260045260246000fd5b500690565b60006020828403121561556257600080fd5b815161138781613677565b60006020828403121561557f57600080fd5b5051919050565b600061012080830188845260206001600160a01b038916818601526155ae604086018961390f565b60e08501929092528551908190526101408401918087019160005b818110156155ea576155dc85855161394f565b9450928201926001016155c9565b50508483036101008601528551808452818701938201925060005b81811015615659578451805160ff1685526020808201516001600160a01b03169086015260408082015190860152606080820151908601526080908101519085015260a08401948301949350600101615605565b50919a9950505050505050505050565b60006020828403121561567b57600080fd5b815161138781613d5456fea164736f6c6343000814000a4275726e69652054686520466c616d653a204f70656e5365612052656465656d61626c65204578616d706c65
Deployed Bytecode
0x6080604052600436106102bb5760003560e01c806370a082311161016e578063c6ab67a3116100cb578063e985e9c51161007f578063f2fde38b11610064578063f2fde38b146106fc578063f80ecba31461070f578063fee81cf41461073c57600080fd5b8063e985e9c5146106c9578063f04e283e146106e957600080fd5b8063c8c0619d116100b0578063c8c0619d1461067f578063de475bf91461069f578063e8a3d485146106b457600080fd5b8063c6ab67a314610649578063c87b56dd1461065f57600080fd5b806395d89b4111610122578063a28eec8711610107578063a28eec8714610603578063a5d7ebcf14610623578063b88d4fde1461063657600080fd5b806395d89b41146105ce578063a22cb465146105e357600080fd5b806381fe13c21161015357806381fe13c2146105755780638da5cb5b14610595578063938e3d7b146105ae57600080fd5b806370a082311461053f578063715018a61461056d57600080fd5b80632a55205a1161021c5780635598f8cc116101d05780636352211e116101b55780636352211e146104e8578063689cc677146105085780636c0360eb1461052a57600080fd5b80635598f8cc1461049957806355f804b3146104c857600080fd5b806342842e0e1161020157806342842e0e1461045e57806342966c681461047157806354d1f13d1461049157600080fd5b80632a55205a146103ff5780632bf453e31461043e57600080fd5b8063095ea7b3116102735780631172f13f116102585780631172f13f146103c457806323b872dd146103e457806325692962146103f757600080fd5b8063095ea7b314610391578063099b6bfa146103a457600080fd5b806304634d8d116102a457806304634d8d1461031757806306fdde0314610337578063081812fc1461035957600080fd5b806301ffc9a7146102c05780630302422f146102f5575b600080fd5b3480156102cc57600080fd5b506102e06102db3660046135bf565b61076f565b60405190151581526020015b60405180910390f35b34801561030157600080fd5b50610315610310366004613635565b6107b3565b005b34801561032357600080fd5b5061031561033236600461368c565b6107cc565b34801561034357600080fd5b5061034c610832565b6040516102ec9190613726565b34801561036557600080fd5b50610379610374366004613739565b6108c4565b6040516001600160a01b0390911681526020016102ec565b61031561039f366004613752565b610903565b3480156103b057600080fd5b506103156103bf366004613739565b610912565b3480156103d057600080fd5b506103156103df3660046137d8565b610990565b6103156103f2366004613848565b610aa2565b610315610ab6565b34801561040b57600080fd5b5061041f61041a366004613889565b610b06565b604080516001600160a01b0390931683526020830191909152016102ec565b34801561044a57600080fd5b506103156104593660046138ab565b610b5b565b61031561046c366004613848565b610bab565b34801561047d57600080fd5b5061031561048c366004613739565b610bd8565b610315610be5565b3480156104a557600080fd5b506104b96104b4366004613739565b610c21565b6040516102ec93929190613a14565b3480156104d457600080fd5b506103156104e3366004613b93565b611058565b3480156104f457600080fd5b50610379610503366004613739565b6110a6565b34801561051457600080fd5b5061051d6110e4565b6040516102ec9190613bc9565b34801561053657600080fd5b5061034c611145565b34801561054b57600080fd5b5061055f61055a366004613c16565b6111d3565b6040519081526020016102ec565b61031561120e565b34801561058157600080fd5b50610315610590366004613c78565b611222565b3480156105a157600080fd5b50638b78c6d81954610379565b3480156105ba57600080fd5b506103156105c9366004613b93565b611260565b3480156105da57600080fd5b5061034c6112a7565b3480156105ef57600080fd5b506103156105fe366004613d62565b6112b6565b34801561060f57600080fd5b5061055f61061e366004613889565b61132f565b610315610631366004613d90565b61138e565b610315610644366004613e15565b611724565b34801561065557600080fd5b5061055f60045481565b34801561066b57600080fd5b5061034c61067a366004613739565b61177f565b34801561068b57600080fd5b5061055f61069a366004613e77565b611808565b3480156106ab57600080fd5b5061034c611825565b3480156106c057600080fd5b5061034c611834565b3480156106d557600080fd5b506102e06106e4366004613ee0565b611841565b6103156106f7366004613c16565b611898565b61031561070a366004613c16565b6118d5565b34801561071b57600080fd5b5061072f61072a366004613f0e565b6118fc565b6040516102ec9190613f4d565b34801561074857600080fd5b5061055f610757366004613c16565b63389a75e1600c908152600091909152602090205490565b60006001600160e01b031982167f81fe13c20000000000000000000000000000000000000000000000000000000014806107ad57506107ad8261194e565b92915050565b6107bb611968565b6107c7600d838361353a565b505050565b6107d4611968565b6107de8282611983565b604080516001600160a01b03841681526bffffffffffffffffffffffff831660208201527ff21fccf4d64d86d532c4e4eb86c007b6ad57a460c27d724188625e755ec6cf6d91015b60405180910390a15050565b60606000805461084190613f85565b80601f016020809104026020016040519081016040528092919081815260200182805461086d90613f85565b80156108ba5780601f1061088f576101008083540402835291602001916108ba565b820191906000526020600020905b81548152906001019060200180831161089d57829003601f168201915b5050505050905090565b600081600052673ec412a9852d173d60c11b601c52602060002082018201805460601b6108f95763ceea21b66000526004601cfd5b6001015492915050565b61090e3383836119d3565b5050565b61091a611968565b6004548015610955576040517f2858c21800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600482905560408051828152602081018490527f7c22004198bf87da0f0dab623c72e66ca1200f4454aa3b9ca30f436275428b7c9101610826565b83158061099f57506009548410155b156109bd57604051636824bccd60e01b815260040160405180910390fd5b6000848152600a60205260409020546c0100000000000000000000000090046001600160a01b0316338114610a1e576040517fc0fc8a8a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a2f610a2a8561442d565b611a74565b6000858152600a602052604090208490610a498282614baf565b50508115610a6057600b610a5e838583614d13565b505b847f79ff3f429db28adc780ec19c3110c1dcfde05728a9c19578b1ec27ee3c93ddcd85600b604051610a9392919061515b565b60405180910390a25050505050565b6107c7610aae84611c24565b848484611c7f565b60006202a30067ffffffffffffffff164201905063389a75e1600c5233600052806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d600080a250565b600082815268aa4ec00224afccfdb76020526040812054606081901c91906127109083610b3a576020515490508060601c93505b606084901b1884600019829004811182023d3d3e9396930204935090915050565b610b63611968565b6000838152673ec412a9852d173d60c11b601c5260209020830183015460601b610ba05760405163677510db60e11b815260040160405180910390fd5b6107c7838383611daa565b610bb6838383610aa2565b813b156107c7576107c783838360405180602001604052806000815250611e64565b610be23382611ef1565b50565b63389a75e1600c523360005260006020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92600080a2565b6040805160e081018252600091810182815260608083018490526080830184905260a0830184905260c08301849052908252602082018190529091831580610c6b57506009548410155b15610c8957604051636824bccd60e01b815260040160405180910390fd5b6000848152600a60209081526040808320815160e081018352815463ffffffff80821683860190815264010000000083048216606085015268010000000000000000830490911660808401526c010000000000000000000000009091046001600160a01b0390811660a084015260018401541660c083015281526002820180548451818702810187019095528085529195929486810194939192919084015b82821015610fac578382906000526020600020906003020160405180606001604052908160008201805480602002602001604051908101604052809291908181526020016000905b82821015610e1c576000848152602090206040805160a08101909152600484029091018054829060ff166005811115610dab57610dab6138d7565b6005811115610dbc57610dbc6138d7565b81526020016000820160019054906101000a90046001600160a01b03166001600160a01b03166001600160a01b03168152602001600182015481526020016002820154815260200160038201548152505081526020019060010190610d70565b50505050815260200160018201805480602002602001604051908101604052809291908181526020016000905b82821015610efd57838290600052602060002090600502016040518060c00160405290816000820160009054906101000a900460ff166005811115610e9057610e906138d7565b6005811115610ea157610ea16138d7565b815281546001600160a01b0361010090910481166020808401919091526001808501546040850152600285015460608501526003850154608085015260049094015490911660a090920191909152918352929092019101610e49565b50505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b82821015610f955760008481526020908190206040805160a08101825260048602909201805460ff8116845261010090046001600160a01b03168385015260018082015492840192909252600281015460608401526003015460808301529083529092019101610f2a565b505050508152505081526020019060010190610d28565b50505050815250509250600b8054610fc390613f85565b80601f0160208091040260200160405190810160405280929190818152602001828054610fef90613f85565b801561103c5780601f106110115761010080835404028352916020019161103c565b820191906000526020600020905b81548152906001019060200180831161101f57829003601f168201915b50505060009687525050600c6020526040909420549294915050565b611060611968565b600261106d828483614d13565b50604080516000815260001960208201527f6bd5c950a8d8df17f772f5af37cb3655737899cbf903264b9795592da439661c9101610826565b6000818152673ec412a9852d173d60c11b601c526020902081018101546001600160a01b0316806110df5763ceea21b66000526004601cfd5b919050565b6060600d8054806020026020016040519081016040528092919081815260200182805480156108ba57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161111e575050505050905090565b6002805461115290613f85565b80601f016020809104026020016040519081016040528092919081815260200182805461117e90613f85565b80156111cb5780601f106111a0576101008083540402835291602001916111cb565b820191906000526020600020905b8154815290600101906020018083116111ae57829003601f168201915b505050505081565b6000816111e857638f4eb6046000526004601cfd5b673ec412a9852d173d60c11b601c528160005263ffffffff601c600c2054169050919050565b611216611968565b6112206000611fcb565b565b61122a612009565b600e6000815461123990615219565b90915550600e5461125790879061125290600190615232565b61209f565b50505050505050565b611268611968565b6003611275828483614d13565b507f905d981207a7d0b6c62cc46ab0be2a076d0298e4a86d0ab79882dbd01ac373788282604051610826929190615245565b60606001805461084190613f85565b8015159050731e0049783f008a0085193e00003d00cd54003c718214818115168215821617905082601c52670a5a2e7a0000000060085233600052806030600c205550806000528160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160206000a35050565b6000828152673ec412a9852d173d60c11b601c5260208120830183015460601b61136c5760405163677510db60e11b815260040160405180910390fd5b60008381526007602090815260408083208584529091529020545b9392505050565b6001600160a01b0383166113a0573392505b600080806113b0848601866152e4565b50506000848152600a6020526040902060028101549497509295509350909184109050611409576040517f13d59cc100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114138482612159565b6116d48482600201858154811061142c5761142c6153c4565b906000526020600020906003020160405180606001604052908160008201805480602002602001604051908101604052809291908181526020016000905b82821015611516576000848152602090206040805160a08101909152600484029091018054829060ff1660058111156114a5576114a56138d7565b60058111156114b6576114b66138d7565b81526020016000820160019054906101000a90046001600160a01b03166001600160a01b03166001600160a01b0316815260200160018201548152602001600282015481526020016003820154815250508152602001906001019061146a565b50505050815260200160018201805480602002602001604051908101604052809291908181526020016000905b828210156115f757838290600052602060002090600502016040518060c00160405290816000820160009054906101000a900460ff16600581111561158a5761158a6138d7565b600581111561159b5761159b6138d7565b815281546001600160a01b0361010090910481166020808401919091526001808501546040850152600285015460608501526003850154608085015260049094015490911660a090920191909152918352929092019101611543565b50505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b8282101561168f5760008481526020908190206040805160a08101825260048602909201805460ff8116845261010090046001600160a01b03168385015260018082015492840192909252600281015460608401526003015460808301529083529092019101611624565b50505050815250508b8b808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508892508d915061226b9050565b837f15774c935df2fa5080dc5a607a78c8c34254853dfb71bf38b28d5ff119533926846000801b8c8c8733604051611711969594939291906153da565b60405180910390a2505050505050505050565b61172f858585610aa2565b833b156117785761177885858585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e6492505050565b5050505050565b60606117a9826000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b6117c65760405163677510db60e11b815260040160405180910390fd5b6000828152600f602052604090205460026117e0826122de565b6040516020016117f1929190615494565b604051602081830303815290604052915050919050565b6000611812611968565b61181d848484612322565b949350505050565b60606008805461084190613f85565b6003805461115290613f85565b6000806118648484601c52670a5a2e7a000000006008526000526030600c205490565b90506001600160a01b038316731e0049783f008a0085193e00003d00cd54003c7114611890578061181d565b159392505050565b6118a0611968565b63389a75e1600c52806000526020600c2080544211156118c857636f5e88186000526004601cfd5b60009055610be281611fcb565b6118dd611968565b8060601b6118f357637448fbae6000526004601cfd5b610be281611fcb565b6060611926846000818152673ec412a9852d173d60c11b601c52602090208101015460601b151590565b6119435760405163677510db60e11b815260040160405180910390fd5b61181d8484846123b8565b600061195982612461565b806107ad57506107ad826124ab565b638b78c6d819543314611220576382b429006000526004601cfd5b6bffffffffffffffffffffffff16612710808211156119aa5763350a88b36000526004601cfd5b8260601b806119c15763b4457eaa6000526004601cfd5b90911768aa4ec00224afccfdb7555050565b60001960601c828116925083811693508160005283673ec412a9852d173d60c11b17601c5260206000208201820180548216915081611a1a5763ceea21b66000526004601cfd5b818514851517611a4057816000526030600c2054611a4057634b6e7f186000526004601cfd5b6001018390558183827f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a450505050565b80516020810151905163ffffffff91821691161115611abf576040517f6f7eac2600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b81602001515181101561090e57600082602001518281518110611ae757611ae76153c4565b6020026020010151905060005b816020015151811015611c1a57600082602001518281518110611b1957611b196153c4565b6020026020010151905060006001600160a01b03168160a001516001600160a01b031603611b73576040517ff821dcf500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060600151600003611bb1576040517f288c10c500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060800151816060015114611c1157606081015160808201516040517fe924c25e00000000000000000000000000000000000000000000000000000000815260048101879052602481019290925260448201526064015b60405180910390fd5b50600101611af4565b5050600101611ac2565b60007fffffffffffffffffffffffffe1ffb687c0ff75ff7ae6c1ffffc2ff32abffc38f3301611c7857611c6b82731e0049783f008a0085193e00003d00cd54003c71611841565b15611c7857506000919050565b5033919050565b611c8a838383612547565b60008181526001600160a01b03948516673ec412a9852d173d60c11b8117601c526020909120820182018054919594851694938416938216918286148302611ced5782611cdf5763ceea21b66000526004601cfd5b63a11481006000526004601cfd5b84611d005763ea553b346000526004601cfd5b856000528160010154925082871486881417871517611d31576030600c2054611d3157634b6e7f186000526004601cfd5b8215611d3f57600082600101555b85851818905550601c600c8181208054600019019055600084905220805460010163ffffffff8116611d79576301336cea6000526004601cfd5b90558082847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a45b50505050565b6000838152600760209081526040808320858452909152902054818103611dfd576040517fc37ca37500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611e086005846125dd565b506000848152600760209081526040808320868452825291829020849055815186815290810184905284917f8386f3b08e49490d0c5a9d2c401c091f13b01a17d75ce4a2f0f8f923b410ff7d910160405180910390a250505050565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a08401528015611eab578060c08401826020870160045afa505b60208360a48301601c860160008a5af1611ecf573d15611ecf573d6000803e3d6000fd5b508060e01b825114611ee95763d1a57ed66000526004601cfd5b505050505050565b6000611efc826110a6565b9050611f0a81600084612547565b5060008181526001600160a01b03928316673ec412a9852d173d60c11b8117601c526020909120820182018054919382169182611f4f5763ceea21b66000526004601cfd5b82600052816001015480861484871417861517611f7e576030600c2054611f7e57634b6e7f186000526004601cfd5b8015611f8c57600083600101555b5082189055601c600c208054600019019055816000827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a4505050565b638b78c6d81980546001600160a01b039092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a355565b30330361201257565b6000805b600d5481101561206557600d8181548110612033576120336153c4565b6000918252602090912001546001600160a01b0316330361205357600191505b8061205d81615219565b915050612016565b5080610be2576040517fcbd9d2e0000000000000000000000000000000000000000000000000000000008152336004820152602401611c08565b6120ab60008383612547565b6001600160a01b0390911690816120ca5763ea553b346000526004601cfd5b80600052673ec412a9852d173d60c11b601c5260206000208101810180548060601b156120ff5763c991cbb16000526004601cfd5b831790556000829052601c600c20805460010163ffffffff811661212b576301336cea6000526004601cfd5b9055808260007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8180a45050565b80544263ffffffff808316821064010000000090930416111517156121cc5780546040517f2b0d2d0700000000000000000000000000000000000000000000000000000000815242600482015263ffffffff80831660248301526401000000009092049091166044820152606401611c08565b80546000838152600c60205260409020546801000000000000000090910463ffffffff16906121fc90600161551b565b111561090e576000828152600c602052604090205461221c90600161551b565b81546040517f3243f3b2000000000000000000000000000000000000000000000000000000008152600481019290925268010000000000000000900463ffffffff166024820152604401611c08565b6000858152600c60205260408120805490919061228790615219565b90915550604084015151156122a4576122a48460400151836125e9565b602084015151156122bd576122bd84602001518461263b565b835151156117785761177885856020015186600001518760400151856129de565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806122f85750819003601f19909101908152919050565b6000612330610a2a8561442d565b506009805490600061234183615219565b909155506000818152600a60205260409020849061235f8282614baf565b5050811561237657600b612374838583614d13565b505b807f79ff3f429db28adc780ec19c3110c1dcfde05728a9c19578b1ec27ee3c93ddcd85600b6040516123a992919061515b565b60405180910390a29392505050565b6060818067ffffffffffffffff8111156123d4576123d4613fb9565b6040519080825280602002602001820160405280156123fd578160200160208202803683370190505b50915060005b8181101561245857600085858381811061241f5761241f6153c4565b905060200201359050612432878261132f565b848381518110612444576124446153c4565b602090810291909101015250600101612403565b50509392505050565b6000612489826301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b806107ad5750632a55205a60e083901c9081146301ffc9a791909114176107ad565b60006001600160e01b031982167f29fd83a100000000000000000000000000000000000000000000000000000000148061250e57506001600160e01b031982167f01ffc9a700000000000000000000000000000000000000000000000000000000145b806107ad57506001600160e01b031982167faf332f3e000000000000000000000000000000000000000000000000000000001492915050565b6001600160a01b0383166107c757600060644460405160200161256c91815260200190565b6040516020818303038152906040528051906020012060001c61258f919061552e565b61259a90600161551b565b90506001603c82108015906125af5750605a82105b156125bc575060026125c8565b605a82106125c8575060035b6000838152600f602052604090205550505050565b60006113878383612a7e565b805182511461263157815181516040517fa722fb5c00000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401611c08565b61090e8282612acd565b805182511461268357815181516040517fdd24e43e00000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401611c08565b6000805b835181101561299b5760008482815181106126a4576126a46153c4565b6020026020010151905060008483815181106126c2576126c26153c4565b602002602001015190506000600260058111156126e1576126e16138d7565b835160058111156126f4576126f46138d7565b14806127125750600483516005811115612710576127106138d7565b145b156127c15760208301516040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905233916001600160a01b031690636352211e90602401602060405180830381865afa15801561277b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279f9190615550565b6001600160a01b0316146127b45760006127b7565b60015b60ff169050612904565b6003835160058111156127d6576127d66138d7565b14806127f457506005835160058111156127f2576127f26138d7565b145b1561288d5760208301516040517efdd58e000000000000000000000000000000000000000000000000000000008152336004820152602481018490526001600160a01b039091169062fdd58e906044015b602060405180830381865afa158015612862573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612886919061556d565b9050612904565b6001835160058111156128a2576128a26138d7565b036128f25760208301516040517f70a082310000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b03909116906370a0823190602401612845565b6060830151612901908661551b565b94505b600083516005811115612919576129196138d7565b1415801561292a5750826060015181105b1561298357602083015160608401516040517f400fb4920000000000000000000000000000000000000000000000000000000081526001600160a01b039092166004830152602482018390526044820152606401611c08565b61298d8284612ec1565b836001019350505050612687565b508034146107c7576040517ffde0d3d800000000000000000000000000000000000000000000000000000000815234600482015260248101829052604401611c08565b60005b8351811015611ee95760008482815181106129fe576129fe6153c4565b6020026020010151905080602001516001600160a01b03166381fe13c28885848a896040518663ffffffff1660e01b8152600401612a40959493929190615586565b600060405180830381600087803b158015612a5a57600080fd5b505af1158015612a6e573d6000803e3d6000fd5b50505050816001019150506129e1565b6000818152600183016020526040812054612ac5575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556107ad565b5060006107ad565b60005b82518110156107c7576000828281518110612aed57612aed6153c4565b602002602001015190506000848381518110612b0b57612b0b6153c4565b60200260200101516000015190506000858481518110612b2d57612b2d6153c4565b60200260200101516080015190506000868581518110612b4f57612b4f6153c4565b60200260200101516020015190506000878681518110612b7157612b716153c4565b60200260200101516040015190506000888781518110612b9357612b936153c4565b60200260200101516060015190506000836001600160a01b031663a28eec8788856040518363ffffffff1660e01b8152600401612bda929190918252602082015260400190565b602060405180830381865afa158015612bf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1b919061556d565b90508560ff16600103612d0457848114612c6f576040516337e0269160e01b81526001600160a01b03851660048201526024810188905260448101849052606481018290526084810186905260a401611c08565b836001600160a01b0316632bf453e3888c8b81518110612c9157612c916153c4565b602002602001015160400151856040518463ffffffff1660e01b8152600401612ccd939291909283526020830191909152604082015260600190565b600060405180830381600087803b158015612ce757600080fd5b505af1158015612cfb573d6000803e3d6000fd5b50505050612eaf565b8560ff16600203612dfe5784811115612d57576040516337e0269160e01b81526001600160a01b03851660048201526024810188905260448101849052606481018290526084810186905260a401611c08565b6000612d63838361551b565b9050846001600160a01b0316632bf453e3898d8c81518110612d8757612d876153c4565b6020026020010151604001518460001b6040518463ffffffff1660e01b8152600401612dc6939291909283526020830191909152604082015260600190565b600060405180830381600087803b158015612de057600080fd5b505af1158015612df4573d6000803e3d6000fd5b5050505050612eaf565b8560ff16600303612e5d5784811015612e51576040516337e0269160e01b81526001600160a01b03851660048201526024810188905260448101849052606481018290526084810186905260a401611c08565b6000612d638383615232565b8560ff16600403612eaf57818114612eaf576040516337e0269160e01b81526001600160a01b03851660048201526024810188905260448101849052606481018290526084810186905260a401611c08565b50505050505081600101915050612ad0565b80604001518214158015612ed85750604081015115155b8015612f145750600481516005811115612ef457612ef46138d7565b141580612f145750600581516005811115612f1157612f116138d7565b14155b15612f6d57602081015160408083015190517f027bbdb40000000000000000000000000000000000000000000000000000000081526001600160a01b039092166004830152602482018490526044820152606401611c08565b60208101516001600160a01b031630148015612f97575060a08101516001600160a01b031661dead145b8015612fa1575060015b15612fb55761090e3383836060015161352b565b600281516005811115612fca57612fca6138d7565b1480612fe85750600481516005811115612fe657612fe66138d7565b145b1561314b5761dead6001600160a01b03168160a001516001600160a01b0316036130f15760208101516040517f42966c68000000000000000000000000000000000000000000000000000000008152600481018490526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561306d57600080fd5b505af192505050801561307e575060015b61090e57602081015160a0820151604051632142170760e11b81523360048201526001600160a01b039182166024820152604481018590529116906342842e0e906064015b600060405180830381600087803b1580156130dd57600080fd5b505af1158015611ee9573d6000803e3d6000fd5b602081015160a0820151604051632142170760e11b81523360048201526001600160a01b039182166024820152604481018590529116906342842e0e90606401600060405180830381600087803b1580156130dd57600080fd5b600381516005811115613160576131606138d7565b148061317e575060058151600581111561317c5761317c6138d7565b145b156132f15761dead6001600160a01b03168160a001516001600160a01b03160361328e57602081015160608201516040517ff5298aca0000000000000000000000000000000000000000000000000000000081523360048201526024810185905260448101919091526001600160a01b039091169063f5298aca90606401600060405180830381600087803b15801561321657600080fd5b505af1925050508015613227575060015b61090e57602081015160a0808301516060840151604051637921219560e11b81523360048201526001600160a01b0392831660248201526044810187905260648101919091526084810192909252600060a48301529091169063f242432a9060c4016130c3565b602081015160a0808301516060840151604051637921219560e11b81523360048201526001600160a01b0392831660248201526044810187905260648101919091526084810192909252600060a48301529091169063f242432a9060c4016130c3565b600181516005811115613306576133066138d7565b0361349a5761dead6001600160a01b03168160a001516001600160a01b03160361343557602081015160608201516040517f79cc679000000000000000000000000000000000000000000000000000000000815233600482015260248101919091526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561339757600080fd5b505af19250505080156133a8575060015b61090e57602081015160a082015160608301516040516323b872dd60e01b81523360048201526001600160a01b03928316602482015260448101919091529116906323b872dd906064016020604051808303816000875af1158015613411573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c79190615669565b602081015160a082015160608301516040516323b872dd60e01b81523360048201526001600160a01b03928316602482015260448101919091529116906323b872dd906064016020604051808303816000875af1158015613411573d6000803e3d6000fd5b60008160a001516001600160a01b03163460405160006040518083038185875af1925050503d80600081146134eb576040519150601f19603f3d011682016040523d82523d6000602084013e6134f0565b606091505b50509050806107c7576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6107c782610be2600082611ef1565b82805482825590600052602060002090810192821561359a579160200282015b8281111561359a57815473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384351617825560209092019160019091019061355a565b506135a69291506135aa565b5090565b5b808211156135a657600081556001016135ab565b6000602082840312156135d157600080fd5b81356001600160e01b03198116811461138757600080fd5b60008083601f8401126135fb57600080fd5b50813567ffffffffffffffff81111561361357600080fd5b6020830191508360208260051b850101111561362e57600080fd5b9250929050565b6000806020838503121561364857600080fd5b823567ffffffffffffffff81111561365f57600080fd5b61366b858286016135e9565b90969095509350505050565b6001600160a01b0381168114610be257600080fd5b6000806040838503121561369f57600080fd5b82356136aa81613677565b915060208301356bffffffffffffffffffffffff811681146136cb57600080fd5b809150509250929050565b60005b838110156136f15781810151838201526020016136d9565b50506000910152565b600081518084526137128160208601602086016136d6565b601f01601f19169290920160200192915050565b60208152600061138760208301846136fa565b60006020828403121561374b57600080fd5b5035919050565b6000806040838503121561376557600080fd5b823561377081613677565b946020939093013593505050565b600060c0828403121561379057600080fd5b50919050565b60008083601f8401126137a857600080fd5b50813567ffffffffffffffff8111156137c057600080fd5b60208301915083602082850101111561362e57600080fd5b600080600080606085870312156137ee57600080fd5b84359350602085013567ffffffffffffffff8082111561380d57600080fd5b6138198883890161377e565b9450604087013591508082111561382f57600080fd5b5061383c87828801613796565b95989497509550505050565b60008060006060848603121561385d57600080fd5b833561386881613677565b9250602084013561387881613677565b929592945050506040919091013590565b6000806040838503121561389c57600080fd5b50508035926020909101359150565b6000806000606084860312156138c057600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052602160045260246000fd5b6006811061390b57634e487b7160e01b600052602160045260246000fd5b9052565b61391a8282516138ed565b6001600160a01b0360208201511660208301526040810151604083015260608101516060830152608081015160808301525050565b61395a8282516138ed565b6020818101516001600160a01b039081169184019190915260408083015190840152606080830151908401526080808301519084015260a091820151169082015260c00190565b600081518084526020808501945080840160005b83811015613a09578151805160ff1688526020808201516001600160a01b03169089015260408082015190890152606080820151908901526080908101519088015260a087019650908201906001016139b5565b509495945050505050565b600060608083526101208301865163ffffffff80825116848701526020808301516080838216818a0152604091508185015160a0858216818c01528887015195506001600160a01b03915081861660c08c015281838801511660e08c0152848e0151965060c06101008c0152879550865191508188526101409750878b019550878260051b8c01019750848701965060005b82811015613b6b578b890361013f19018752875180518b8b5280518c8c0181905290880190600090878d01905b80831015613afa57613ae682855161390f565b928a01926001929092019190860190613ad3565b50838a01518d82038e8c01528051808352908b019350908a0191506000905b80821015613b3e57613b2c83855161394f565b92508a84019350600182019150613b19565b5050918701518b83038c89015291613b5681846139a1565b9b505050978601975095850195600101613aa6565b5050505087850382890152613b80858b6136fa565b9701979097525093979650505050505050565b60008060208385031215613ba657600080fd5b823567ffffffffffffffff811115613bbd57600080fd5b61366b85828601613796565b6020808252825182820181905260009190848201906040850190845b81811015613c0a5783516001600160a01b031683529284019291840191600101613be5565b50909695505050505050565b600060208284031215613c2857600080fd5b813561138781613677565b60008083601f840112613c4557600080fd5b50813567ffffffffffffffff811115613c5d57600080fd5b60208301915083602060a08302850101111561362e57600080fd5b6000806000806000806000878903610120811215613c9557600080fd5b883597506020890135613ca781613677565b965060a0603f1982011215613cbb57600080fd5b5060408801945060e088013567ffffffffffffffff80821115613cdd57600080fd5b818a0191508a601f830112613cf157600080fd5b813581811115613d0057600080fd5b8b602060c083028501011115613d1557600080fd5b602083019650809550506101008a0135915080821115613d3457600080fd5b50613d418a828b01613c33565b989b979a50959850939692959293505050565b8015158114610be257600080fd5b60008060408385031215613d7557600080fd5b8235613d8081613677565b915060208301356136cb81613d54565b600080600080600060608688031215613da857600080fd5b853567ffffffffffffffff80821115613dc057600080fd5b613dcc89838a016135e9565b909750955060208801359150613de182613677565b90935060408701359080821115613df757600080fd5b50613e0488828901613796565b969995985093965092949392505050565b600080600080600060808688031215613e2d57600080fd5b8535613e3881613677565b94506020860135613e4881613677565b935060408601359250606086013567ffffffffffffffff811115613e6b57600080fd5b613e0488828901613796565b600080600060408486031215613e8c57600080fd5b833567ffffffffffffffff80821115613ea457600080fd5b613eb08783880161377e565b94506020860135915080821115613ec657600080fd5b50613ed386828701613796565b9497909650939450505050565b60008060408385031215613ef357600080fd5b8235613efe81613677565b915060208301356136cb81613677565b600080600060408486031215613f2357600080fd5b83359250602084013567ffffffffffffffff811115613f4157600080fd5b613ed3868287016135e9565b6020808252825182820181905260009190848201906040850190845b81811015613c0a57835183529284019291840191600101613f69565b600181811c90821680613f9957607f821691505b60208210810361379057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715613ff257613ff2613fb9565b60405290565b60405160a0810167ffffffffffffffff81118282101715613ff257613ff2613fb9565b6040516060810167ffffffffffffffff81118282101715613ff257613ff2613fb9565b6040805190810167ffffffffffffffff81118282101715613ff257613ff2613fb9565b604051601f8201601f1916810167ffffffffffffffff8111828210171561408a5761408a613fb9565b604052919050565b63ffffffff81168114610be257600080fd5b600067ffffffffffffffff8211156140be576140be613fb9565b5060051b60200190565b60068110610be257600080fd5b600082601f8301126140e657600080fd5b813560206140fb6140f6836140a4565b614061565b82815260c0928302850182019282820191908785111561411a57600080fd5b8387015b8581101561419a5781818a0312156141365760008081fd5b61413e613fcf565b8135614149816140c8565b81528186013561415881613677565b8187015260408281013590820152606080830135908201526080808301359082015260a08083013561418981613677565b90820152845292840192810161411e565b5090979650505050505050565b60ff81168114610be257600080fd5b600082601f8301126141c757600080fd5b813560206141d76140f6836140a4565b82815260a092830285018201928282019190878511156141f657600080fd5b8387015b8581101561419a5781818a0312156142125760008081fd5b61421a613ff8565b8135614225816141a7565b81528186013561423481613677565b8187015260408281013590820152606080830135908201526080808301359082015284529284019281016141fa565b600082601f83011261427457600080fd5b6142816140f683356140a4565b82358082526020808301929160051b850101858111156142a057600080fd5b602085015b818110156144225767ffffffffffffffff80823511156142c457600080fd5b813587016060818a03601f190112156142dc57600080fd5b6142e461401b565b82602083013511156142f557600080fd5b602082013582018a603f82011261430b57600080fd5b602081013561431c6140f6826140a4565b81815260a090910282016040019060208101908d83111561433c57600080fd5b6040840193505b828410156143bb5760a0848f03121561435b57600080fd5b614363613ff8565b61436d85356140c8565b8435815261437e6020860135613677565b602085013560208201526040850135604082015260608501356060820152608085013560808201528083525060208201915060a084019350614343565b845250505060408201358310156143d157600080fd5b6143e48a602060408501358501016140d5565b602082015282606083013511156143fa57600080fd5b61440d8a602060608501358501016141b6565b604082015286525050602093840193016142a5565b509095945050505050565b600081360360c081121561444057600080fd5b61444861403e565b60a082121561445657600080fd5b61445e613ff8565b9150833561446b81614092565b8252602084013561447b81614092565b6020830152604084013561448e81614092565b604083015260608401356144a181613677565b606083015260808401356144b481613677565b608083015290815260a08301359067ffffffffffffffff8211156144d757600080fd5b6144e336838601614263565b60208201529392505050565b600081356107ad81613677565b6000808335601e1984360301811261451357600080fd5b83018035915067ffffffffffffffff82111561452e57600080fd5b6020019150600581901b360382131561362e57600080fd5b60008235605e1983360301811261455c57600080fd5b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b8054600080835581156107c75760027f3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831683146145bc576145bc614566565b8382526020822083821b81015b80821015611ee95783825583600183015583838301558360038301556004820191506145c9565b6801000000000000000082111561460957614609613fb9565b8054828255808310156107c75760027f3fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff808316831461464a5761464a614566565b808516851461465b5761465b614566565b5060008381526020812085831b81019084841b015b80821015611257578282558260018301558284830155826003830155600482019150614670565b8054600080835581156107c757600582810281810484146146ba576146ba614566565b84835260208320908101905b81811015611ee95783815583600182015583600282015583600382015583600482015582810190506146c6565b6801000000000000000082111561470c5761470c613fb9565b8054828255808310156107c7576005818102818104831461472f5761472f614566565b848202828104861461474357614743614566565b6000858152602081209283019291909101905b82821015611257578082558060018301558060028301558060038301558060048301558382019150614756565b6000808335601e1984360301811261479a57600080fd5b83018035915067ffffffffffffffff8211156147b557600080fd5b602001915060a08102360382131561362e57600080fd5b600682106147ea57634e487b7160e01b600052602160045260246000fd5b60ff1981541660ff831681178255505050565b6000808335601e1984360301811261481457600080fd5b83018035915067ffffffffffffffff82111561482f57600080fd5b602001915060c08102360382131561362e57600080fd5b61485083826146f3565b818160005260208060002060005b86811015611257578335614871816140c8565b61487b81846147cc565b508284013561488981613677565b825474ffffffffffffffffffffffffffffffffffffffff001916600882901b74ffffffffffffffffffffffffffffffffffffffff00161783555060408401356001830155606084013560028301556080840135600383015560a08401356148ef81613677565b60048301805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383161790555060c093909301926005919091019060010161485e565b61493a83826145f0565b818160005260208060002060005b8681101561125757833561495b816141a7565b60ff811660ff19845416178355508284013561497681613677565b825474ffffffffffffffffffffffffffffffffffffffff001916600882901b74ffffffffffffffffffffffffffffffffffffffff00161783555060408401356001830155606084013560028301556080840135600383015560a084019350600482019150600181019050614948565b6149ef8283614783565b6149f981846145f0565b8260005260208060002060005b83811015614aa0578435614a19816140c8565b614a2381846147cc565b5082850135614a3181613677565b825474ffffffffffffffffffffffffffffffffffffffff001916600882901b74ffffffffffffffffffffffffffffffffffffffff00161783555060408501356001830155606085013560028301556080850135600383015560a085019450600482019150600181019050614a06565b5050614aae818601866147fd565b9350915050614ac1828260018601614846565b5050614ad06040830183614783565b611da4818360028601614930565b68010000000000000000831115614af757614af7613fb9565b805483825580841015614b715760038181028181048314614b1a57614b1a614566565b8582028281048714614b2e57614b2e614566565b60008581526020902091820191015b81811015614b6d57614b4e8161457c565b614b5a60018201614697565b614b666002820161457c565b8201614b3d565b5050505b5060008181526020812083915b85811015611ee957614b99614b938487614546565b836149e5565b6020929092019160039190910190600101614b7e565b8135614bba81614092565b63ffffffff8116905081548163ffffffff1982161783556020840135614bdf81614092565b67ffffffff000000008160201b169050808367ffffffffffffffff198416171784556040850135614c0f81614092565b6bffffffff00000000000000008160401b16846bffffffffffffffffffffffff19851617831717855550505050614c75614c4b606084016144ef565b82546bffffffffffffffffffffffff1660609190911b6bffffffffffffffffffffffff1916178255565b614cb2614c84608084016144ef565b600183016001600160a01b03821673ffffffffffffffffffffffffffffffffffffffff198254161781555050565b614cbf60a08301836144fc565b611da4818360028601614ade565b601f8211156107c757600081815260208120601f850160051c81016020861015614cf45750805b601f850160051c820191505b81811015611ee957828155600101614d00565b67ffffffffffffffff831115614d2b57614d2b613fb9565b614d3f83614d398354613f85565b83614ccd565b6000601f841160018114614d735760008515614d5b5750838201355b600019600387901b1c1916600186901b178355611778565b600083815260209020601f19861690835b82811015614da45786850135825560209485019460019092019101614d84565b5086821015614dc15760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6000808335601e19843603018112614dea57600080fd5b830160208101925035905067ffffffffffffffff811115614e0a57600080fd5b8060051b360382131561362e57600080fd5b6000808335601e19843603018112614e3357600080fd5b830160208101925035905067ffffffffffffffff811115614e5357600080fd5b60a08102360382131561362e57600080fd5b6000808335601e19843603018112614e7c57600080fd5b830160208101925035905067ffffffffffffffff811115614e9c57600080fd5b60c08102360382131561362e57600080fd5b8183526000602080850194508260005b85811015613a09578135614ed1816140c8565b614edb88826138ed565b5082820135614ee981613677565b6001600160a01b039081168885015260408381013590890152606080840135908901526080808401359089015260a09081840135614f2681613677565b169088015260c0968701969190910190600101614ebe565b8183526000602080850194508260005b85811015613a09578135614f61816141a7565b60ff16875281830135614f7381613677565b6001600160a01b03168784015260408281013590880152606080830135908801526080808301359088015260a09687019690910190600101614f4e565b81835260006020808501808196508560051b810191508460005b878110156150d15782840389528135605e19883603018112614feb57600080fd5b87016060858101614ffc8380614e1c565b8389529182905260809182890160005b8281101561507057833561501f816140c8565b61502983826138ed565b508b84013561503781613677565b6001600160a01b0316828d0152604084810135908301528584013586830152848401358583015260a0938401939091019060010161500c565b5061507d8b870187614e65565b955093508981038b8b0152615093818686614eae565b94505050505060406150a781840184614e1c565b9350878303828901526150bb838583614f3e565b9c89019c97505050928601925050600101614fca565b5091979650505050505050565b600081546150eb81613f85565b808552602060018381168015615108576001811461512257615150565b60ff1985168884015283151560051b880183019550615150565b866000528260002060005b858110156151485781548a820186015290830190840161512d565b890184019650505b505050505092915050565b604081526000833561516c81614092565b63ffffffff908116604084015260208501359061518882614092565b908116606084015260408501359061519f82614092565b16608083015260608401356151b381613677565b6001600160a01b0390811660a08401526080850135906151d282613677565b1660c08301526151e560a0850185614dd3565b60c060e08501526151fb61010085018284614fb0565b915050828103602084015261521081856150de565b95945050505050565b60006001820161522b5761522b614566565b5060010190565b818103818111156107ad576107ad614566565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b600082601f83011261528557600080fd5b813567ffffffffffffffff81111561529f5761529f613fb9565b6152b2601f8201601f1916602001614061565b8181528460208386010111156152c757600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c087890312156152fd57600080fd5b86359550602080880135955060408801359450606088013567ffffffffffffffff8082111561532b57600080fd5b818a0191508a601f83011261533f57600080fd5b813561534d6140f6826140a4565b81815260059190911b8301840190848101908d83111561536c57600080fd5b938501935b8285101561538a57843582529385019390850190615371565b9750505060808a0135945060a08a01359250808311156153a957600080fd5b50506153b789828a01615274565b9150509295509295509295565b634e487b7160e01b600052603260045260246000fd5b86815260006020878184015260a060408401528560a08401527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff86111561542057600080fd5b8560051b808860c086013760c09084018481038201606086015286519181018290528287019160009160e001905b8083101561546e578351825292840192600192909201919084019061544e565b506001600160a01b0387166080870152935061548992505050565b979650505050505050565b60008084546154a281613f85565b600182811680156154ba57600181146154cf576154fe565b60ff19841687528215158302870194506154fe565b8860005260208060002060005b858110156154f55781548a8201529084019082016154dc565b50505082870194505b5050505083516155128183602088016136d6565b01949350505050565b808201808211156107ad576107ad614566565b60008261554b57634e487b7160e01b600052601260045260246000fd5b500690565b60006020828403121561556257600080fd5b815161138781613677565b60006020828403121561557f57600080fd5b5051919050565b600061012080830188845260206001600160a01b038916818601526155ae604086018961390f565b60e08501929092528551908190526101408401918087019160005b818110156155ea576155dc85855161394f565b9450928201926001016155c9565b50508483036101008601528551808452818701938201925060005b81811015615659578451805160ff1685526020808201516001600160a01b03169086015260408082015190860152606080820151908601526080908101519085015260a08401948301949350600101615605565b50919a9950505050505050505050565b60006020828403121561567b57600080fd5b815161138781613d5456fea164736f6c6343000814000a
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.