Skip to main content

Protocol Overview

Limora is a decentralized leveraged trading protocol built on Base. This document provides a technical overview of how the protocol works.

Architecture

The Limora protocol consists of several interconnected components:

Core Components

Trading Contract

The Trading Contract handles all trade-related operations:
  • Opening new positions (long/short)
  • Closing existing positions
  • Liquidating undercollateralized positions
  • Processing stop-loss and take-profit orders

Matching Contract

The Matching Contract manages liquidity provision:
  • Depositing collateral from matchers
  • Matching pending trades with available liquidity
  • Tracking matched positions and interest accrual
  • Processing withdrawal requests

Vault Contract

The Vault Contract serves as the secure storage layer:
  • Holds all deposited collateral
  • Manages fund transfers between traders and matchers
  • Enforces access controls and security policies

Trade Lifecycle

A typical trade follows this lifecycle:
1

Trade Request

Trader submits a trade request with: - Trading pair - Direction (long/short)
  • Collateral amount - Leverage - Optional stop-loss/take-profit
2

Pending State

Trade enters pending state, waiting for a matcher to provide liquidity.
3

Matching

A matcher deposits funds to match the trade, locking both parties’ collateral.
4

Active Position

Position is now active: - P&L calculated against oracle price - Interest accrues to the matcher - Stop-loss/take-profit monitored
5

Closure

Position closes via: - Manual close by trader - Stop-loss/take-profit trigger - Liquidation if margin insufficient
6

Settlement

Final settlement: - P&L calculated at closing price - Funds distributed to both parties - Interest paid to matcher

Position Mechanics

Long Positions

When a trader opens a long position:
  • Trader profits if the asset price increases
  • Matcher profits if the asset price decreases
  • Liquidation occurs if price drops below the liquidation threshold
Example:
Collateral: 100 USDC
Leverage: 10x
Position Size: 1,000 USDC
Entry Price: $50,000 BTC

If BTC rises to $55,000 (+10%):
  Profit = 1,000 USDC × 10% = 100 USDC (100% return on collateral)

If BTC falls to $45,000 (-10%):
  Loss = 1,000 USDC × 10% = 100 USDC (100% loss, near liquidation)

Short Positions

When a trader opens a short position:
  • Trader profits if the asset price decreases
  • Matcher profits if the asset price increases
  • Liquidation occurs if price rises above the liquidation threshold

Collateral and Margin

Initial Margin

Initial margin is the collateral required to open a position:
Initial Margin = Position Size / Leverage

Maintenance Margin

Positions must maintain a minimum margin level to avoid liquidation:
Maintenance Margin = Position Size × Maintenance Margin Rate

Liquidation

When a position’s margin falls below the maintenance margin:
  1. Position is flagged for liquidation
  2. Liquidation bot executes the close
  3. Remaining collateral distributed:
    • Liquidation penalty to protocol
    • Remaining to appropriate party

Interest Model

Interest accrues continuously on open positions:
Hourly Interest = Position Size × Hourly Interest Rate
The interest rate is determined by:
  • Utilization rate of the matching pool
  • Market conditions
  • Protocol parameters
Interest is paid from the trader to the matcher for the duration of the position.

Security Model

Smart Contract Security

  • All contracts are audited by reputable security firms
  • Upgradability follows strict governance procedures
  • Emergency pause functionality for critical situations

Oracle Security

  • Multi-source price aggregation
  • Deviation checks against historical data
  • Staleness protection to reject outdated prices

Access Control

  • Role-based permissions for administrative functions
  • Time-locks on critical parameter changes
  • Multi-sig requirements for sensitive operations

Protocol Parameters

Key configurable parameters:
ParameterDescriptionDefault
Max LeverageMaximum allowed leverage100x
Liquidation ThresholdMargin level triggering liquidation80%
Opening FeeFee charged on position opening0.08%
Closing FeeFee charged on position closing0.08%
Base Interest RateMinimum hourly interest rate0.001%

Network Details

Limora is deployed on the Base network:
PropertyValue
NetworkBase Mainnet
Chain ID8453
Native TokenETH
Block Time~2 seconds

Further Reading