/* Crafted with love by Fueled on Bacon https://fueledonbacon.com */ //SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/access/Ownable.sol"; import "./ERC721ARoyalty.sol"; import "./interfaces/IERC721AOperator.sol"; abstract contract ERC721AOperator is IERC721AOperator, ERC721ARoyalty { event SetSellPrice(uint256 tokenId, uint256 sellPrice); uint32 public startTime; address public paymentToken; address internal _secondarySalesRoyaltyReceiver; uint96 internal _secondarySalesRoyaltyFeeDenominator; // tokenId => entryTypePos mapping(uint256 => uint256) internal _ticketByEntryPos; // in the form of tokenId => paymentPrice mapping(uint256 => uint256) public priceByToken; function versionERC721AOperator() virtual external pure override returns (string memory){ return "1.0.0-beta.0+fob.rsv.iERC721AOperator"; } function setSellingPrice(uint256[] memory tokenIds, uint256[] memory sellPrices) external virtual override { if(tokenIds.length != sellPrices.length) revert ERC721AOPWrongBatchLengths(); for(uint256 i; i < tokenIds.length; i++) { uint256 tokenId = tokenIds[i]; uint256 sellPrice = sellPrices[i]; if(ownerOf(tokenId) != _msgSender()) revert ERC721AOPNotOwnedToken(); if(sellPrice == 0) revert ERC721AOPInvalidSellPrice(); priceByToken[tokenId] = sellPrice; emit SetSellPrice(tokenId, sellPrice); } } function _saveTickets( uint256 currentIndex, uint256 amount, uint256 entryPos, uint256[] memory sellingPrices ) internal { uint256 nextTokenId = currentIndex; for(uint256 i; i < amount; i++) { uint256 tokenId = nextTokenId+i; _ticketByEntryPos[tokenId] = entryPos; uint256 sellPrice = sellingPrices[i]; if(sellPrice == 0) revert ERC721AOPInvalidSellPrice(); priceByToken[tokenId] = sellPrice; _setTokenRoyalty(tokenId, _secondarySalesRoyaltyReceiver, _secondarySalesRoyaltyFeeDenominator); } } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721ARoyalty) returns (bool) { return interfaceId == type(IERC721AOperator).interfaceId || super.supportsInterface(interfaceId); } }