Query Helper
Quadrata provides a suite of helper functions as a library contract deployed on chain.
Quadrata provides a suite of helper functions as a library contract deployed on chain.
npm i @quadrata/contracts --save-dev
Description: Anti-money laundering risk scoring of the passport holder.
Checks if returned AML attribute value is equal to supplied uint256 value.
import "@quadrata/contracts/utility/QuadReaderUtils.sol";
using QuadReaderUtils as bytes32;
IQuadPassportStore.Attribute[] memory attributes = reader.getAttributes{
value: queryFee
}(_account, keccak256("AML"));
if (attributes[0].value.amlIsEqual(8))
// Checks if _account has an AML risk score equals to 8
Checks if returned AML attribute value is greater than supplied uint256 value.
Checks if returned AML attribute value is greater than or equal to supplied uint256 value.
Checks if returned AML attribute value is less than supplied uint256 value.
Checks if returned AML attribute value is less than or equal to supplied uint256 value.
Checks if returned AML attribute value is between a min and max threshold inclusively.
import "@quadrata/contracts/utility/QuadReaderUtils.sol";
using QuadReaderUtils as bytes32;
IQuadPassportStore.Attribute[] memory attributes = reader.getAttributes{
value: queryFee
}(_account, keccak256("AML"));
if (attributes[0].value.amlBetweenInclusive(2, 8))
// Checks if _account has an AML risk score between 2 and 8
Checks if returned AML attribute value is between a min and max threshold exclusively.
import "@quadrata/contracts/utility/QuadReaderUtils.sol";
using QuadReaderUtils as bytes32;
IQuadPassportStore.Attribute[] memory attributes = reader.getAttributes{
value: queryFee
}(_account, keccak256("AML"));
if (attributes[0].value.amlBetweenExclusive(2, 8))
// Checks if _account has an AML risk score between 2 (excluded) and 8 (excluded)
Defines whether the passport is for an individual consumer or a business entity.
Checks if returned isBusiness attribute value is True.
import "@quadrata/contracts/utility/QuadReaderUtils.sol";
using QuadReaderUtils as bytes32;
IQuadPassportStore.Attribute[] memory attributes = reader.getAttributes{
value: queryFee
}(_account, keccak256("IS_BUSINESS"));
if (attributes[0].value.isBusinessTrue())
// address _account is a Business Passport
Defines the country where the government ID was issued. Uses ISO 31266 standard for two-letter country encodings.
Checks if returned country attribute value is equal to supplied string value.
import "@quadrata/contracts/utility/QuadReaderUtils.sol";
using QuadReaderUtils as bytes32;
IQuadPassportStore.Attribute[] memory attributes = reader.getAttributes{
value: queryFee
}(_account, keccak256("COUNTRY"));
if (attributes[0].value.countryIsEqual("US"))
// address _account is not equal to "US"
Cred Protocol’s credit score predicts the likelihood of borrowers being liquidated or defaulting on loans in the next 90 days (range 300-1000)
Checks if returned Cred Protocol Score attribute value is equal to supplied uint256 value.
import "@quadrata/contracts/utility/QuadReaderUtils.sol";
using QuadReaderUtils as bytes32;
IQuadPassportStore.Attribute[] memory attributes = reader.getAttributes{
value: queryFee
}(_account, keccak256("CRED_PROTOCOL_SCORE"));
if (attributes[0].value.credProtocolScoreIsEqual(750))
// Checks if Cred Protocol Score is equal to "750"
Checks if returned Cred Protocol Score attribute value is greater than supplied uint256 value.
Checks if returned Cred Protocol Score attribute value is greater than or equal to supplied uint256 value.
Checks if returned Cred Protocol Score attribute value is less than supplied uint256 value.
Checks if returned Cred Protocol Score attribute value is less than or equal to supplied uint256 value.
Checks if returned Cred Protocol Score attribute value is between a min and max threshold inclusively.
Checks if returned Cred Protocol Score attribute value is between a min and max threshold exclusively.
Last modified 1mo ago