Query Helper
Quadrata provides a suite of helper functions as a library contract deployed on chain.
Installation
npm i @quadrata/contracts --save-devAML
amlIsEqual(bytes32 _attrValue, uint256 _expectedAmlValue)
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)
amlGreaterThanEqual(bytes32 _attrValue, uint256 _lowerBound)
amlLessThan(bytes32 _attrValue, uint256 _upperBound)
amlLessThanEqual(bytes32 _attrValue, uint256 _upperBound)
amlBetweenInclusive(bytes32 _attrValue, uint256 _lowerBound, uint256 _upperBound)
amlBetweenExclusive(bytes32 _attrValue, uint256 _lowerBound, uint256 _upperBound)
IS_BUSINESS
isBusinessTrue(bytes32 _attrValue)
COUNTRY
countryIsEqual(bytes32 _attrValue, string _expectedCountry)
CRED_PROTOCOL_SCORE
credProtocolScoreIsEqual(bytes32 _attrValue, uint256 _expectedScore)
credProtocolScoreGreaterThan(bytes32 _attrValue, uint256 _lowerBound)
credProtocolScoreGreaterThanEqual(bytes32 _attrValue, uint256 _lowerBound)
credProtocolScoreLessThan(bytes32 _attrValue, uint256 _upperBound)
credProtocolScoreLessThanEqual(bytes32 _attrValue, uint256 _upperBound)
credProtocolScoreBetweenInclusive(bytes32 _attrValue, uint256 _lowerBound, uint256 _upperBound)
credProtocolScoreBetweenExclusive(bytes32 _attrValue, uint256 _lowerBound, uint256 _upperBound)
Last updated