Quadrata Integration
  • INTRODUCTION
    • Introduction to Quadrata
    • Passport Attributes
  • HOW TO INTEGRATE
    • Quadrata SDK
      • Get Started Quickly
      • Advanced
        • Installation
        • SDK Configuration
        • Onboarding Example
        • Client Libraries
          • Client Configuration
          • Client Lazy Loading
          • Client Eager Loading
          • Client Helper Component
          • Client React Hooks
            • useOnboardStatus
          • Client Examples
            • With Wagmi Connect
            • KYC Only
            • KYB Only
            • All In One
        • API Libraries
          • API Configuration
          • API Service Options
          • API Service Libraries
            • Create Access Token
            • Create Privacy Access Token
            • Fetch Attribute Values
            • Fetch Onboard Status
            • Fetch Passport List
            • Fetch Privacy Data
            • Fetch Privacy Grants
            • Fetch Wallet Screening
            • Revoke Privacy Grants
    • Onboard users
      • Individual Passport Onboarding
        • 1. Installation
        • 2. API Authentication
        • 3. API Onboard Status
        • 4. QuadClient Package
        • 5. Privacy Data Permissions
        • 6. Full Example
      • Business Passport Onboarding
        • 1. Installation
        • 2. API Authentication
        • 3. QuadrataKyb Package
        • 4. Privacy Data Permissions
        • 5. Full Example
      • All-In-One Passport Onboarding
        • 1. Installation
        • 2. API Authentication
        • 3. QuadrataReact Package
        • 4. Full Example
    • Request Privacy Data
      • List of Privacy Data
      • Privacy Data Permissions
      • API Requests
        • How to sign API
          • Full Example
          • Generate ECDSA Key Pair
        • API Get Privacy Permissions
        • API Privacy Access Token
        • API Get Privacy Data
        • API Revoke Permissions
    • Query attributes
      • Via Smart Contract
        • Query a single attribute
        • Query multiple attributes
        • Query Helper
      • Via API
    • On-Chain Wallet Screening
      • How to sign API
        • Full Example
        • Generate ECDSA Key Pair
      • API Get On-Chain AML Score
    • Webhooks
      • Onboarding Webhooks
      • Ongoing Monitoring Webhooks
      • Webhook Request Signature
    • Burn Passports
  • additional information
    • Smart contracts
    • Quadrata Sandbox
    • Passport Issuers
    • Privileged Roles & Ownership
    • Constants
    • Flex Kit Attributes
      • Smart Contract Addresses
Powered by GitBook
On this page
  • Installation
  • AML
  • amlIsEqual(bytes32 _attrValue, uint256 _expectedAmlValue)
  • amlGreaterThan(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)
  1. HOW TO INTEGRATE
  2. Query attributes
  3. Via Smart Contract

Query Helper

Quadrata provides a suite of helper functions as a library contract deployed on chain.

PreviousQuery multiple attributesNextVia API

Last updated 2 years ago

Quadrata provides a suite of helper functions as a library contract deployed on chain.

The library implementation is available on our .

Installation

can be imported from Quadrata starting from v0.3.1.

npm i @quadrata/contracts --save-dev

AML

Description: Anti-money laundering risk scoring of the passport holder.

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 8

amlGreaterThan(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.

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

amlBetweenExclusive(bytes32 _attrValue, uint256 _lowerBound, uint256 _upperBound)

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)

IS_BUSINESS

Defines whether the passport is for an individual consumer or a business entity.

isBusinessTrue(bytes32 _attrValue)

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

COUNTRY

Defines the country where the government ID was issued. Uses ISO 31266 standard for two-letter country encodings.

countryIsEqual(bytes32 _attrValue, string _expectedCountry)

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_SCORE

Cred Protocol’s credit score predicts the likelihood of borrowers being liquidated or defaulting on loans in the next 90 days (range 300-1000)

credProtocolScoreIsEqual(bytes32 _attrValue, uint256 _expectedScore)

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"

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.

Visit for more information

github
QuadReaderUtils.sol
contract npm package
https://www.credprotocol.com/