Validating Policies

Policies can be validated by attaching them to passes or directly via API calls. Passes that are tied to policies will automatically be validated each time they are scanned. To attach policies to passes, please refer to our guides under passes here. To validate passes policies our API, refer to the API reference here.

Interpreting Results

Each time a policy is validated, you will receive a JSON response containing a breakdown of the policy object and all the rules you have created for it. Within each rule, you will be able to determine whether the rule was satisfied or not, and if it failed, you will receive information on why it failed.

When validating policies using using api/v0/policies/validate, you'll see a response similar to this below.

[
  {
    "address": "0xF888f4fAad70F542a80176f8b63438402C937473",
    "satisfiesAllPolicies": true,
    "policies": [
      {
        "valid": true,
        "verifiedBlockNumber": 17679850,
        "id": "5edc7c10-fe93-4868-a6f5-c0e7213d4076",
        "name": "Badam Bomb Squad",
        "chain": {
          "name": "evm",
          "network": "1"
        },
        "ruleEvaluation": "ANY",
        "minRules": null,
        "rules": [
          {
            "id": "98d79755-9484-47de-99a1-a630e5f0d2e9",
            "type": "COLLECTION",
            "satisfiesRule": 1,
            "data": {
              "contractAddress": "0x72c1cb01dcbe46c9e912ab5aef5bf0bed21a6e55"
            },
            "valid": true,
            "results": {
              "currentBalance": 2
            }
          }
        ]
      }
    ]
  }
]

Policy

The response is in the form of an array because it allows for the validation of multiple wallet addresses against policies. Each object within the array will contain three parent-level properties: address, satisfiesAllPolicies, and policies.

The address property represents the wallet owner's address, while satisfiesAllPolicies is a boolean value that simplifies determining whether all policies have been met.

The policies property contains the same object properties as our policy model. In addition, it includes a valid property that indicates whether the policy's requirements are met, and verifiedBlockNumber, which specifies the block number used to check asset ownership requirements.

Rules

Each policy consists of one or more rules, which are represented by the rules array within policies. Each rule has the same object properties as our rule model. It also includes a valid property that indicates whether the rule requirements are met, and a results object that provides further information about the evaluated rule.

The results object contains three possible properties: currentBalance, tokenChecks, and ruleViolation.

  • currentBalance: This property reflects the balance of the user's wallet based on the rule type.
  • tokenChecks: If your rule has a condition that specifies a list of token IDs, this property will be present. It contains an array of objects that break down each token ID and its specific balance.
  • ruleViolation: An enumeration value that provides details on why a rule condition was not met.

Rule Violation Enum Values:

ValueDescription
ALLOW_LIST_CONDITION_NOT_METWallet address is not included in the allow list
ATTRIBUTES_CONDITION_NOT_METUser does not own an NFT with the required attributes
BALANCE_CONDITION_NOT_METUser does not meet the balance requirements of the rule
HOLDING_TIME_CONDITION_NOT_METUser holds the correct token, but does not meet the holding time requirements
OWNERSHIP_REQUIREMENT_NOT_METUser does not own any NFTs from the collection
RESTRICTED_TOKENS_CONDITION_NOT_METUser owns NFT(s) from a collection, but the preset IDs do not match