// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "../../contract-registry/IContractEntity.sol"; import "../../renting/Rentings.sol"; interface ITokenQuote is IContractEntity { /** * @dev Thrown when the message sender is not Metahub. */ error CallerIsNotMetahub(); /** * @dev Thrown when trying to work with expired token quote. */ error TokenQuoteExpired(); /** * @dev Thrown when trying to work with token quote signed by entity missing quote signing role. */ error InvalidTokenQuoteSigner(); /** * @dev Thrown when token quote listing id does not equal one provided from renting params. */ error TokenQuoteListingIdMismatch(); /** * @dev Thrown when token quote renter address does not equal one provided from renting params. */ error TokenQuoteRenterMismatch(); /** * @dev Thrown when token quote warper address does not equal one provided from renting params. */ error TokenQuoteWarperMismatch(); /** * @dev Describes the universe-specific token quote data. * @param paymentToken Address of payment token. * @param paymentTokenQuote Quote of payment token in accordance to base token */ struct PaymentTokenData { address paymentToken; uint256 paymentTokenQuote; } /** * @dev Describes the universe-specific-to-base token quote. * @param listingId Listing ID. * @param renter Address of renter. * @param warperAddress Address of warper. * @param paymentToken Address of payment token. * @param paymentTokenQuote Quote of payment token in accordance to base token * @param nonce Anti-replication mechanism value. * @param deadline The maximum possible time when token quote can be used. */ struct TokenQuote { uint256 listingId; address renter; address warperAddress; address paymentToken; uint256 paymentTokenQuote; uint256 nonce; uint32 deadline; } /** * @dev Using and verification of the price quote for universe-specific token in relation to base token. * @param rentingParams Renting params. * @param baseTokenFees Base fees in equivalent of base token. * @param tokenQuote Encoded token quote. * @param tokenQuoteSignature Token Quote ECDSA signature ABI encoded (v,r,s)(uint8, bytes32, bytes32). * @return paymentTokenFees Payment token fees calculated in accordance with payment token quote. * @return paymentTokenData Payment token data. */ function useTokenQuote( Rentings.Params calldata rentingParams, Rentings.RentalFees memory baseTokenFees, bytes calldata tokenQuote, bytes calldata tokenQuoteSignature ) external returns (Rentings.RentalFees memory paymentTokenFees, PaymentTokenData memory paymentTokenData); /** * @dev Getting the nonce for token quote. * This 'nonce' should be included in the signature of TokenQuote * @param renter Address of the renter. */ function getTokenQuoteNonces(address renter) external view returns (uint256); /** * @dev Getting the Chain ID */ function getChainId() external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }