Lynx Finance
WebsiteApp
  • Welcome to Lynx
    • Introduction
    • Core Design
      • Gross Profit and Loss (P&L)
      • Isolated Liquidity Pools
      • Guaranteed Solvency
      • Trigger Bots
    • Cross-Chain Perpetuals
      • Intent-Based Order System
      • Transaction Flow
  • For Users
    • Funding Your Account
    • Liquidity Providers
    • Traders
      • Trading Competitions
      • Cat Mode (High-Leverage)
      • Asset Classes
      • 💎 Sonic Gem Credits
    • Fees
    • Tutorials
      • Deposit/Withdraw to Lynx Account
      • Supply/Remove Liquidity
      • Open/Close a Trade
      • Update Take Profit/Stop Loss
  • For Partners
    • List Your Token
    • Incentive Campaigns
  • Community
    • Glossary
    • FAQs
    • Brand Logo & Guidelines
  • Security
    • Audit Report
    • Deployed Contracts
Powered by GitBook
On this page
  • Funding your Account
  • Submitting Intents on Lynx
  • Withdrawing Funds from your Account
  1. Welcome to Lynx
  2. Cross-Chain Perpetuals

Transaction Flow

How Trades are Handled Behind the Scenes

PreviousIntent-Based Order SystemNextFunding Your Account

Last updated 4 months ago

Funding your Account

To begin trading or providing liquidity on Lynx, users must first deposit funds into their Lynx account by submitting a transaction from any supported chain. Upon depositing funds, the user will receive an equivalent amount of chips, minted directly to their wallet on an engine chain.

While funding an account requires a standard on-chain transaction, it allows all subsequent interactions on Lynx to be submitted via intents thereby eliminating the need for the user to pay their gas fees.

How are Chips Minted

The process of minting chips is powered by LayerZero; it works similar to the way a standard lock-and-mint bridge works:

  1. User Deposits TKN: After submitting the transaction to fund their account, the user's TKN is transferred from their wallet to a secure holding contract on the origin chain.

  2. LayerZero Communicates the Deposit Cross-Chain: The contract triggers a message, sent by LayerZero, from the origin chain to the engine chain.

  3. User Receives TKN Chips in their Wallet: The token minting contract on the engine chain mints chips to the user's wallet, representing their deposited TKN.

With chips now in their wallet on the engine chain, the user is free to begin trading (or supplying liquidity) on Lynx. To do so, the user can begin submitting intents from their origin chain without needing to connect to the engine chain.

Users who interact with Lynx directly from an engine chain will circumvent LayerZero: their funds will be moved to a holding contract on the engine chain and they'll then receive chips on the engine chain. They also will submit regular, gas-consuming transactions while connected to the engine chain rather than intents from an origin chain.

Submitting Intents on Lynx

Let's look at an example of a user who wants to open a trade on Lynx. The user first sets up their trade parameters on the Lynx app (eg. traded amount, leverage, stop loss, etc.). When they are ready to open their position, they click "Place Order" on the application UI and the intent signing process begins:

  1. User Submits Intent on Lynx: Instead of being prompted by their wallet provider to confirm a transaction, the user will receive a request to sign a message. By clicking "Sign", the user sends a request (ie. intent) to open their trade.

  2. Intent Published as On-Chain Transaction: Once the intent has been submitted, a solver bot mines the intent, publishing it as a transaction on the engine chain.

  3. Transaction is Triggered, Opening the Trade: A whitelisted bot triggers the now on-chain request, transferring chips from the user's wallet accordingly and opening the requested position.

Withdrawing Funds from your Account

At any point in time, a user can withdraw their funds from their Lynx account. This process burns the appropriate number of chips from the user's wallet on the engine chain and releases their funds to their wallet on the origin chain. The steps are similar to funding your account, with the key difference that withdrawing funds is initiated as an intent, not a transaction:

  1. LayerZero Communicates the Deposit Cross-Chain: A cross-chain message is sent by LayerZero on the engine chain to LayerZero on the origin chain.

  2. User Receives TKN Back: Upon receiving the message on the origin chain, the 'release' function on the Lynx contract is triggered and the user's TKN is sent back to their wallet on the origin chain.

Similar to the process of funding your account from an engine chain, withdrawing funds to an engine chain does not utilize LayerZero. Instead, chips are burned and funds are released directly to the user's wallet without bridging.

User Initiates TKN Withdrawal: The user requests to withdraw their TKN using Lynx's . The intent is verified by the intent verifier contract and then published on the engine chain, burning the user's chips and triggering a cross-chain message.

intent system