credible-std, then test them with pcl before deployment. You can develop them independently or work with our forward deployed engineers to define and implement the policies.
Set Up Your Project
Start with Installation. To try a working project, follow Run an Example Policy Locally, then Test a Policy’s Allowed and Rejected Cases. Keep assertion contracts inassertions/src/ and their tests in assertions/test/. Pin the credible-std version used by your project and confirm that your target deployment supports the assertion specification you choose. See the library reference and published releases.
Define the Policy and Its Exceptions
Describe the behavior your policy should reject and the legitimate operations it must allow. Identify:- The protected contracts, assets, and execution paths.
- The property being checked, including units, thresholds, and any measurement window.
- Approved exceptions, such as migrations, ownership transfers, or large withdrawals.
Implement the Assertion
Inherit fromAssertion and register the assertion functions in triggers(). For Reshiram assertions, call registerAssertionSpec(AssertionSpec.Reshiram) in the constructor.
Match the trigger to the property:
- Use
registerTxEndTriggerfor a property that must hold after the complete transaction. - Use
registerFnCallTriggerfor a check around each matching function call. Its call context is available throughph.context(). - Use the supported token-change or cumulative-flow triggers when the policy concerns token movements or rolling limits.
_preTx() and _postTx() identify transaction boundaries; _preCall() and _postCall() identify call boundaries. Read values through ph.loadStateAt or ph.staticcallAt, and derive storage slots from the actual contract layout.
Keep each assertion focused on one property. Check helper mutability when calling it from a view function, and decode events and calldata according to the protocol’s interfaces. Use Triggers, the Cheatcodes Reference, and your pinned library source for exact signatures.
Test Allowed and Rejected Transactions
UseCredibleTest and register the assertion with cl.assertion(...) immediately before the monitored external call. Run the assertion tests with:

