High-Level Overview
This page presents an overview of a Ride's components and the flow taken through a Ride. But, first consider reviewing the terminology.


The following terminology is applied to describe DeFi Pooling flows on StarkEx:
  • The Admin is an entity that registers new Rides and activates the operation required for the different phases of the DeFi Pooling flow.
  • An Investment token is a token type that a user invests in a DeFi strategy, i.e., the "payment".
  • A Ride ticket is a temporary intermediate token that the user buys with their Investment tokens in order to join a DeFi Pooling Ride. These tokens mediate between the Investment tokens and the Strategy tokens to coordinate multiple users to invest together in the same strategy.
  • A Strategy token is a token type that the user receives once invested in a DeFi strategy. This token represents the ownership of funds in the strategy. These funds are redeemable at any point in time using the on-chain strategy smart contract.
  • Passengers are off-chain users that have joined a Ride, i.e., signed the required transactions to participate in the Ride.
  • A Ride defines a specific on-chain strategy. A Ride consists of the following parameters:
    • an on-chain Pool Manager contract
    • an Investment token
    • a Strategy token
    • a Ride ticket token
    • The price and slippage for exchanging Strategy tokens for Investment tokens. The users can decide whether to join a Ride based on these parameters.

System Components

A DeFi Pooling system consists of the following components:
1. StarkEx is made up of off-chain and on-chain components.
These include the StarkEx services, the StarkEx smart contract, and a STARK verifier smart contract. StarkEx:
  • batches multiple DeFi Pooling operations from different users
  • updates the off-chain state
  • registers the new state on-chain along with a proof attesting to the validity of the new state
2. DeFi Pooling Operator this component receives requests from users to join a specific Ride.
It manages the users' signed transactions and also matches and settles trades between users and the on-chain Pool Manager smart contract.
3. Pool Manager is a smart contract, on-chain component.
It executes the on-chain strategy for the Pool of funds collected from the Ride passengers. This contract coordinates between the DeFi contract in order to execute the strategy, and the StarkEx contract, in order to exchange funds with the Ride passengers.

Flow Phases

A DeFi Pooling flow proceeds in four phases:
1. Register a new Ride
A new Ride is configured to execute a specific strategy at a specific price.
2. User onboarding
Multiple users join a Ride by buying Ride tickets.
3. Ride execution
The on-chain Pool Manager smart contract withdraws the passengers' funds and trades them for Strategy tokens. The trade succeeds only if the trading price is lower or equal to the price defined at step 1.
4. User offboarding
Passengers trade their Ride ticket for Strategy tokens.
The following sections describe these four phases in detail, explain how to preserve self-custody of funds in this flow, and present how a user can exit a strategy they joined.