Skip to content

The Liquid protocol is an open protocol for democratizing access to DeFi

License

Notifications You must be signed in to change notification settings

metastable-labs/liquid-protocol

Repository files navigation

Liquid Protocol

Liquid Curator is a permissionless strategy curation protocol. It introduces a new primitive for creating, managing, and executing complex DeFi strategies across multiple protocols. The protocol enables trustless strategy curation with atomic execution. It provides a framework for strategy composers to create and monetize their expertise while allowing users and AI Agents to discover, evaluate, and participate in these strategies with minimal friction.

Architecture

The protocol consists of several key components:

1. Strategy Module

  • Strategy Contract: Core contract that manages strategy creation and tracking
    • Stores strategy metadata and execution steps
    • Tracks strategy statistics and performance
    • Manages user participation records
    • Handles curator registration

2. Execution Engine

  • Engine Contract: Handles atomic execution of strategy steps
    • Validates and executes multi-step strategies
    • Manages token approvals and transfers
    • Ensures atomic execution (all steps succeed or revert)
    • Updates strategy and user statistics

3. Protocol Connectors

  • Connector Contracts: Protocol-specific adapters that:
    • Standardize interactions with external protocols (Morpho, Moonwell, etc.)
    • Handle protocol-specific logic and token conversions
    • Track protocol-level balances and shares
    • Report performance metrics back to the strategy module

Component Diagram

Sequence Diagram / Execution Flow

⚠️ Warning: This version of Liquid protocol hasn't been audited, so use it with caution for test purposes only.

Roadmap (not in order):

  • Single step strategies
  • Multi-step strategy curation
  • Yield and rewards calculation
  • Onchain risk analysis
  • Simulating strategy before creation
  • Making some of the contracts upgradeable

Get started

  1. Clone the repository We recommend using GH CLI:

    gh repo clone metastable-labs/liquid-protocol ~/metastable-labs/liquid-protocol
    cd ~/metastable-labs/liquid-protocol
  2. Install Foundry Make sure you have Foundry installed. If not, you can install it by following the instructions here.

  3. Install dependencies Run the following command to install the necessary dependencies:

    forge update && forge install

Deployments

If you encounter this error:

Error: "./shell/deploy.base.sh: Permission denied"

Run this command:

chmod +x shell/deploy.*.sh

Deploy

sh shell/deploy.sh --network=<NETWORK>

where can be anything between ["base", "scroll", "mode", "op"]

Help in deployment

sh shell/deploy.sh ---help

Adding new network

  1. Duplicate any deploy.NETWORK.sh file and name it deploy.DESIRED_NETWORK.sh
  2. Add two enviornment variables to .env and .env.example file
DESIRED_NETWORKSCAN_API_KEY=
DESIRED_NETWORK_RPC_URL=
  1. In the file deploy.DESIRED_NETWORK.sh file update the following variables
export ETHERSCAN_API_KEY=$DESIRED_NETWORKSCAN_API_KEY
export RPC_URL=$DESIRED_NETWORK_RPC_URL
  1. Add the network to array of allowed_networks in file deploy.sh.
  2. Run the command
sh shell/deploy.sh --network=DESIRED_NETWORK
``