PCL Precompile
Manage on-chain compliance policies directly from your smart contracts.
The Programmable Compliance Layer (PCL) Precompile is a special-purpose smart contract at a fixed address that serves as the bridge between the EVM and Maroo's native compliance engine. It allows developers to programmatically define, update, and enforce regulatory and business rules for their dApps using standard Solidity tooling. This eliminates the need for off-chain oracles for compliance checks and embeds rule enforcement directly into the transaction lifecycle.
Key Features
On-Chain Policy Management
Register, read, update, and remove compliance policies for any smart contract, directly from another authorized smart contract.
Dual-Track Transaction Model
Utilize the `runOnPcl` function to execute transactions within a regulated context, ensuring all relevant global and contract-specific policies are checked before execution.
Extensible Policy Templates
System administrators can register new types of compliance checks (Policy Templates) which can then be configured and used by any contract on the network.
EVM Native Interface
Interact with the entire PCL system using a standard Solidity interface (`IPcl.sol`), complete with custom errors and events for robust dApp development.
Architecture
graph TD
subgraph EVM Space
A[DApp / User] -- EVM Call --> B{Your Smart Contract};
B -- `runOnPcl(target, data, value)` --> C[PCL Precompile @ 0x10...05];
end
subgraph Maroo Native Layer
D[x/pcl Cosmos SDK Module];
E[Policy Storage];
F[Compliance Logic];
end
C -- Native Bridge --> D;
D -- Reads --> E[Policy Storage];
D -- Executes --> F[Compliance Logic];
F -- Pass/Fail --> D;
D -- Result --> C;
C -- Returns / Reverts --> B;
B -- `(bool success, bytes memory result) = target.call(data)` --> G{Execute Original Call};
G -- Returns --> B;
B -- Returns --> A; A user's call to a compliant smart contract is intercepted and forwarded to the PCL Precompile. The precompile bridges the call to the native x/pcl module, which loads relevant policies and executes compliance logic. If the checks pass, control is returned to the EVM to execute the original intended call.
How It Works
x/pcl Cosmos SDK module. When a developer wants to make a contract compliant, they don't add the logic to the contract itself. Instead, they register policies against that contract's address using the precompile.The core of the enforcement mechanism is the
runOnPcl function. Instead of a user or contract directly calling a function on a regulated contract (e.g., myToken.transfer(...)), they call pcl.runOnPcl(myToken, encodedTransfer, ...) instead. This function first triggers the native PCL module to perform all necessary checks based on the policies registered for myToken. These checks can include verifying the sender's KYC status, checking against denylists, or enforcing transfer volume limits. If and only if all checks pass, the PCL precompile then uses a low-level EVM call to execute the original, encoded transfer function. If any check fails, the entire transaction reverts with a descriptive custom error.Global vs. Contract Policies
runOnPcl, both global and contract-specific policies are evaluated. This layered approach allows for network-wide safety nets while giving individual dApp developers the flexibility to define their own specific rules.