// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "../../../metahub/core/IMetahub.sol"; import "../../../contract-registry/Contracts.sol"; import "../../../warper/warper-manager/IWarperManager.sol"; import "../../../listing/listing-strategy-registry/IListingStrategyRegistry.sol"; import "../../../tax/tax-terms-registry/ITaxTermsRegistry.sol"; library ListingWizardsHelperV1 { /** * @dev Thrown when the Universe does not support the Original Asset Collection. * @param universeId The Universe. * @param collection The address of unsupported by the `universeId` Original Asset Collection. */ error UniverseDoesNotSupportAsset(uint256 universeId, address collection); function validateMatchWithUniverse( uint256 universeId, address originalCollection, IListingTermsRegistry.ListingTerms calldata terms, IMetahub metahub ) internal view { // get [0] element from Universe Asset Warpers // cause right now there is a limit that Universe can have only 1 Warper for unique asset. (address[] memory warperAddresses, ) = IWarperManager(metahub.getContract(Contracts.WARPER_MANAGER)) .universeAssetWarpers(universeId, originalCollection, 0, 1); if (warperAddresses.length == 0) { revert UniverseDoesNotSupportAsset(universeId, originalCollection); } bytes4 taxStrategyId = IListingStrategyRegistry(metahub.getContract(Contracts.LISTING_STRATEGY_REGISTRY)) .listingTaxId(terms.strategyId); ITaxTermsRegistry.Params memory taxTermsParams = ITaxTermsRegistry.Params({ taxStrategyId: taxStrategyId, universeId: universeId, warperAddress: warperAddresses[0] }); ITaxTermsRegistry(metahub.getContract(Contracts.TAX_TERMS_REGISTRY)).checkRegisteredUniverseTaxTermsWithParams( taxTermsParams ); } }