Kwenta Documentation
DiscordKwentaTwitterBlog
  • 🥂Welcome to Kwenta
  • Getting Started
    • How to start using Kwenta
    • Introduction
    • Getting started on Optimism
    • How to get sUSD
    • Access Kwenta
      • Installing the IPFS Companion to Access Kwenta
      • Backup RPCs
      • Withdrawing from v2 Isolated Margin using Optimistic Etherscan
  • Using Kwenta
    • Futures on Kwenta
    • Jargon
    • Synthetix Isolated Margin
      • Funding
        • Technical Details
      • Delayed Orders
      • Maker/Takers on Kwenta
      • Leverage
      • Liquidations
      • Initial/Maintenance Margin
      • One-Click Trading
        • Onboarding to 1CT
        • FAQ
      • Smart Margin
        • Dashboard Overview
        • Futures UI Overview
        • Get Started with Smart Margin
          • Withdrawing sUSD & ETH
          • Opening/Closing Positions
          • Conditional Orders
            • Limit Orders
            • Stop-Loss Orders
          • FAQ
      • Delegated Trading
        • Getting started
        • Managing Delegates
        • Accessing Accounts Delegate to You
      • Fees
      • Referral Program
        • The Traders Tab
        • The Affiliates Tab
        • Incentive Tiers and Rewards
      • FAQ
    • Perennial Isolated Margin
      • Perennial Intro
        • Market Design
        • Oracles
        • Payoff & Positions
        • Trading Fees and Price Impact
        • Funding Rate
        • Interest Rate
        • Leverage & Liquidations
        • Collateral
        • CodeBase
      • Bridging to Arbitrum
      • Trading on Perennial
        • Dashboard Overview
        • Futures UI Overview
        • Opening/Closing Positions
        • Advanced Orders
          • Limit Orders
          • Stop-Loss Orders
      • Gasless Trading
        • Onboarding to 1-Click-Trading
        • FAQ
  • Kwenta Token
    • Staking KWENTA
      • How to stake KWENTA
      • Escrow and Vesting
      • Transferring Escrow Entries
    • Claiming Rewards
    • Trading Rewards
  • DAO
    • Kwenta Token
    • Governance
    • MarketingDAO
    • devDAO
      • Contributing to the Kwenta Frontend
        • Troubleshooting
        • Testing
  • Developers
    • Deployed Contracts
      • V2 Futures Market Proxy Contracts
    • Verify Kwenta
    • Kwenta SDK
  • Resources
    • Audits
    • Development progress Epoch 1 2024
    • GitHub
Powered by GitBook
On this page

Was this helpful?

  1. Using Kwenta
  2. Perennial Isolated Margin
  3. Perennial Intro

Oracles

PreviousMarket DesignNextPayoff & Positions

Last updated 10 months ago

Was this helpful?

Oracles are the core of each market within Perennial. Each market pulls in one or more prices from oracles to be used in the payoff function.

While a simple market will just use a single price feed (ex. ETH), more complex market could use payoffs with multiple price feeds (ex. ETH / BTC).

Perennial's modular design supports custom oracles. Currently, Perennial markets use an implementation of low latency oracles, allowing for fast & efficient price updates.

Settlement

Since the is computed directly from the oracle price, a lag needs to introduced into the settlement system so that entering and exiting positions cannot be timed to arbitrage the market.

Time in Perennial markets is split into units called oracle versions. Settlement only occurs on the transition of one oracle version to another. When a user requests to open or close a new position, that position delta sits in a pending state until the next oracle version update, after which it takes effect.

Settlement Flow:

In this example: the user calls open(10) at during oracle version 1, and close(10) during oracle version 3. The user's position opens at the start of version 2 and closes at the start of version 4, meaning they are exposed to the price difference between versions 2 and 4.

Oracle Version
User Action
Pending
Oracle Price
Position (Profit/loss)

1

Open 1 ETH

Opening: 10

Closing: 0

$1000

- (0)

2

Opening: 0

Closing: 0

$1025

1 ETH (0)

3

Close 1 ETH

Opening: 0

Closing: 10

$1075

1 ETH (+$50)

4

Opening: 0

Closing: 0

$1050

- (+$25)

Developer Note: The settlement flow happens entirely on-chain, giving strong guarantees for projects building on top of Perennial.

Perennial smart contracts store the current version for position adjustments, allowing for the positions opening price & PnL to be retroactively calculated at the next on-chain settlement period (when the contracts are interacted with again), avoiding the need for a second interaction during opens/closing (or the need for a keeper).

Pyth's
market payoff