contract GodsUnchainedValidator is
    IPropertyValidator
{
    IGodsUnchained internal GODS_UNCHAINED; // solhint-disable-line var-name-mixedcase

    using LibBytes for bytes;

    constructor(address _godsUnchained)
        public
    {
        GODS_UNCHAINED = IGodsUnchained(_godsUnchained);
    }

    /// @dev Checks that the given card (encoded as assetData) has the proto and quality encoded in `propertyData`.
    ///      Reverts if the card doesn't match the specified proto and quality.
    /// @param tokenId The ERC721 tokenId of the card to check.
    /// @param propertyData Encoded proto and quality that the card is expected to have.
    function checkBrokerAsset(
        uint256 tokenId,
        bytes calldata propertyData
    )
        external
        view
    {
        (uint16 expectedProto, uint8 expectedQuality) = abi.decode(
            propertyData,
            (uint16, uint8)
        );

        // Validate card properties.
        (uint16 proto, uint8 quality) = GODS_UNCHAINED.getDetails(tokenId);
        require(proto == expectedProto, "GodsUnchainedValidator/PROTO_MISMATCH");
        require(quality == expectedQuality, "GodsUnchainedValidator/QUALITY_MISMATCH");
    }
}
function checkBrokerAsset(
    uint256 tokenId,
    bytes calldata propertyData
)
    external
    view
{
    (uint16 expectedProto, uint8 expectedQuality) = abi.decode(
        propertyData,
        (uint16, uint8)
    );

    // Validate card properties.
    (uint16 proto, uint8 quality) = GODS_UNCHAINED.getDetails(tokenId);
    require(proto == expectedProto, "GodsUnchainedValidator/PROTO_MISMATCH");
    require(quality == expectedQuality, "GodsUnchainedValidator/QUALITY_MISMATCH");
}

/// @dev Checks that the given card (encoded as assetData) has the proto and quality encoded in `propertyData`.
///      Reverts if the card doesn't match the specified proto and quality.
/// @param tokenId The ERC721 tokenId of the card to check.
/// @param propertyData Encoded proto and quality that the card is expected to have.