Overview

The pcl (Phylax Credible Layer) is a command-line interface for interacting with the Credible Layer. It allows developers to authenticate, test, and submit assertions to the Credible Layer dApp.

Project Structure

The pcl command expects the following directory structure:
root-dir/
  assertions/
    src/      # Assertion source files (.a.sol)
    test/     # Test files (.t.sol)
You will most likely have a src directory on the same level as the assertions directory, where you develop your protocol smart contracts and a test directory where you develop your tests, so a typical project structure might look like this:
my-protocol/
  assertions/
    src/      # Assertion source files (.a.sol)
    test/     # Test files (.t.sol)
  src/
    MyProtocol.sol # Protocol smart contracts
  test/
    MyProtocol.t.sol # Protocol tests

Commands

auth

Manage authentication with your Credible Layer dApp account.
Authenticate the CLI with your Credible Layer dApp account

Usage: pcl auth [OPTIONS] <COMMAND>

Commands:
  login   Login to PCL using your wallet
  logout  Logout from PCL
  status  Check current authentication status
  help    Print this message or the help of the given subcommand(s)

Options:
      --base-url <BASE_URL>  Base URL for authentication service [env: AUTH_BASE_URL=] [default: https://dapp.phylax.systems]
  -h, --help                 Print help
When logging in:
  1. A URL and authentication code will be displayed
  2. Visit the URL in your browser
  3. Connect your wallet and approve the authentication
  4. CLI will automatically detect successful authentication

config

Manage your PCL configuration:
Manage configuration

Usage: pcl config <COMMAND>

Commands:
  show    Display the current configuration
  delete  Delete the current configuration
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help
Configuration is stored in ~/.pcl/config.toml and includes:
  • Authentication token
  • Pending assertions for submission
  • Project settings

test

Run tests for your assertions.
pcl test -h
Run tests

Usage: pcl test [OPTIONS] [PATH]

Options:
  -h, --help  Print help (see more with '--help')

Display options:
  -v, --verbosity...                Verbosity level of the log messages.
  -q, --quiet                       Do not print log messages
      --json                        Format log messages as JSON
      --color <COLOR>               The color of the log messages [possible values: auto, always, never]
  -s, --suppress-successful-traces  Suppress successful test traces and show only traces for failures [env: FORGE_SUPPRESS_SUCCESSFUL_TRACES=]
      --junit                       Output test results as JUnit XML report
  -l, --list                        List tests instead of running them
      --show-progress               Show test execution progress
      --summary                     Print test summary table
      --detailed                    Print detailed test summary table
Note: The pcl test command is a fork of Forge’s test command so all functionality is available. We’ve omitted most of the options for brevity.

store

Submit Assertion bytecode and source code to the Assertion DA. Be aware that if your assertion contract has constructor arguments, you need to pass them to the pcl store command.
Submit the Assertion bytecode and source code to be stored by the Assertion DA of the Credible Layer

Usage: pcl store [OPTIONS] <ASSERTION_CONTRACT> [CONSTRUCTOR_ARGS]...

Arguments:
  <ASSERTION_CONTRACT>   Name of the assertion contract to build and flatten
  [CONSTRUCTOR_ARGS]...  Constructor arguments for the assertion contract.
                                                  Format: <ARG0> <ARG1> <ARG2>

Options:
  -u, --url <URL>    URL of the assertion-DA server [env: PCL_DA_URL=] [default: https://demo-21-assertion-da.phylax.systems]
  -r, --root <ROOT>  Root directory of the project
  -h, --help         Print help (see more with '--help')
Example of an assertion contract that takes the address of the smart contract it protects as a constructor argument:
pcl store MyAssertion 0xADDRESS_OF_SMART_CONTRACT
If you’re using ph.getAssertionAdopter() in your assertion contract and aren’t adding any additional contract state variables to your assertion contract, you don’t need to provide constructor arguments when storing the assertion.

submit

Submit assertions to the Credible Layer dApp. If you have provided a constructor argument when storing the assertion, you need to provide it when submitting the assertion. If no options are provided, the command will prompt interactively to select the project and assertion(s).
If you have stored several assertions that you want to submit to the same project, it’s fastest to use the interactive mode for selecting the project and assertions.
Submit assertions to the Credible Layer dApp

Usage: pcl submit [OPTIONS]

Options:
  -u, --dapp-url <API Endpoint>          Base URL for the Credible Layer dApp API [default: https://dapp.phylax.systems/api/v1]
  -p, --project-name <PROJECT>           Optional project name to skip interactive selection
  -a, --assertion-keys <ASSERTION_KEYS>  Optional list of assertion name and constructor args to skip interactive selection Format: assertion_name OR
                                         'assertion_name(constructor_arg0,constructor_arg1)'
  -h, --help                             Print help (see more with '--help')
Example:
pcl submit -a 'MyAssertion(0xADDRESS_OF_SMART_CONTRACT)' -p my-project

Examples

Complete Authentication Flow

# Login
pcl auth login

# Verify status
pcl auth status

# Store assertion
pcl store my_assertion 0xADDRESS_OF_SMART_CONTRACT

# Submit to dApp
pcl submit -a 'my_assertion(0xADDRESS_OF_SMART_CONTRACT)' -p my_project

# Logout when done
pcl auth logout

Troubleshooting

Authentication Issues

  • Error: Not authenticated: Run pcl auth login to authenticate
  • Error: Authentication expired: Run pcl auth login to refresh your authentication
  • Browser doesn’t open: Manually visit the URL displayed in the terminal

Submission Issues

  • Error: Failed to submit: Ensure you’re authenticated and have network connectivity
  • Error: Project not found: Create a project in the Credible Layer dApp first
  • Error: Assertion not found: Ensure the assertion name is correct and exists in your project
  • If the assertion takes constructor arguments, make sure to provide them when submitting the assertion