Skip to main content

Smart Contracts

1

Select client contract

Use BasicPredicateClient for most integrations. Use PredicateClient only if your policy validates function calls, parameters, or value-based limits.
2

Inherit and implement

Your contract will inherit the selected client contract and implement the protected functions
3

Deploy your contract

Include the PredicateRegistry address and PolicyID in your deployment

Mental model

  • Onchain, Predicate effectively serves as access control for your protected business logic
  • Your contract(s), via PredicateClient or BasicPredicateClient, requires each transaction to be accompanied with an attestation before executing protected business logic.
  • If the attestation is valid and unexpired, execution proceeds; otherwise the transaction reverts.
Both PredicateClient and BasicPredicateClient contracts leverage ERC-7201 namespaced storage for upgrade safety and are audited.

”Predicated” functions

To gate a function behind Predicate, add an Attestation parameter and call _authorizeTransaction before your business logic. This function is provided by the PredicateClient and verifies that the caller has a valid, unexpired attestation signed by a registered Predicate attester.Any function that calls _authorizeTransaction is predicated — it will revert unless the caller provides a compliant attestation from the Predicate API.

Deploying Your Contracts

A deployed contract is a prerequisite in order to complete onboarding to our dashboard
After implementing the Predicate Client (see examples below), you’ll need to set the Registry address and PolicyID.
  • _policyID: The policy identifier generated during onboarding from the predicate dashboard - you’ll get this in the next step.
  • _registry: The Predicate Registry address. See Supported Chains.

Installation

npm i @predicate/contracts

Examples


Next Step: Dashboard Setup to configure your organization and policies.