Verifier Module

The Verifier Module is an optional module that individually manages authentication and access to the following pool functions:

  • swap

  • depositLiquidity

  • withdrawLiquidity

The Verifier Module passes verification bytes encoded data to Liquidity Modules, allowing for different swap logic for different parties. The verifier module can also be used for simply gating access to these functions in a permissioned setup.

verifierModule can be set in the constructor as an immutable value. If set as address(0) the pool will be completely permissionless, and none of the functions described below would apply.

verifierModule has to implement the following function:

function verify(
        address _user,
        bytes calldata _verificationContext,
        uint8 accessType
    ) external returns (bool success, bytes memory returnData);
  • _user The address of msg.sender which is calling either swap, depositLiquidity or withdrawLiquidity in the Sovereign Pool. This is used as a convenient way to perform authentication of external callers.

  • _verificationContext Optional byte encoded calldata. This can be used to pass off-chain or external data which is critical to the module's logic.

  • accessType Flag which tells the Verifier Module through which pool function it is being called:

    • accessType=0 if verify is being called via swap

    • accessType=1 if verify is being called via depositLiquidity

    • accessType=2 if verify is being called via withdrawLiquidity

The verify function returns two variables:

  • success If True, the pool’s execution control flow will continue uninterrupted, otherwise it will revert.

  • returnData Byte encoded data to be passed to Liquidity Module’s getLiquidityQuote function, in the case of success=True

Verifier modules make it straightforward to constrain/customize access to liquidity pools without requiring changes to the Liquidity Module or core protocol contracts. This allows for custom verification logic while preserving pre-established security assumptions.

Last updated