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.
Installation
QuadReaderUtils.sol can be imported from Quadrata contract npm package starting from v0.3.1.
npm i @quadrata/contracts --save-devAML
amlIsEqual(bytes32 _attrValue, uint256 _expectedAmlValue)
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 8amlGreaterThan(bytes32 _attrValue, uint256 _lowerBound)
Checks if returned AML attribute value is greater than supplied uint256 value.
amlGreaterThanEqual(bytes32 _attrValue, uint256 _lowerBound)
Checks if returned AML attribute value is greater than or equal to supplied uint256 value.
amlLessThan(bytes32 _attrValue, uint256 _upperBound)
Checks if returned AML attribute value is less than supplied uint256 value.
amlLessThanEqual(bytes32 _attrValue, uint256 _upperBound)
Checks if returned AML attribute value is less than or equal to supplied uint256 value.
amlBetweenInclusive(bytes32 _attrValue, uint256 _lowerBound, uint256 _upperBound)
Checks if returned AML attribute value is between a min and max threshold inclusively.
amlBetweenExclusive(bytes32 _attrValue, uint256 _lowerBound, uint256 _upperBound)
Checks if returned AML attribute value is between a min and max threshold exclusively.
IS_BUSINESS
isBusinessTrue(bytes32 _attrValue)
Checks if returned isBusiness attribute value is True.
COUNTRY
countryIsEqual(bytes32 _attrValue, string _expectedCountry)
Checks if returned country attribute value is equal to supplied string value.
CRED_PROTOCOL_SCORE
credProtocolScoreIsEqual(bytes32 _attrValue, uint256 _expectedScore)
Checks if returned Cred Protocol Score attribute value is equal to supplied uint256 value.
credProtocolScoreGreaterThan(bytes32 _attrValue, uint256 _lowerBound)
Checks if returned Cred Protocol Score attribute value is greater than supplied uint256 value.
credProtocolScoreGreaterThanEqual(bytes32 _attrValue, uint256 _lowerBound)
Checks if returned Cred Protocol Score attribute value is greater than or equal to supplied uint256 value.
credProtocolScoreLessThan(bytes32 _attrValue, uint256 _upperBound)
Checks if returned Cred Protocol Score attribute value is less than supplied uint256 value.
credProtocolScoreLessThanEqual(bytes32 _attrValue, uint256 _upperBound)
Checks if returned Cred Protocol Score attribute value is less than or equal to supplied uint256 value.
credProtocolScoreBetweenInclusive(bytes32 _attrValue, uint256 _lowerBound, uint256 _upperBound)
Checks if returned Cred Protocol Score attribute value is between a min and max threshold inclusively.
credProtocolScoreBetweenExclusive(bytes32 _attrValue, uint256 _lowerBound, uint256 _upperBound)
Checks if returned Cred Protocol Score attribute value is between a min and max threshold exclusively.
Last updated