Swap

Linx Swap, integrated into Linx App and Linx Wallet, is a powerful feature of the Linx ecosystem that enhances user access to decentralized liquidity across two high-performance blockchains: Kadena and Alephium. By aggregating liquidity from multiple decentralized exchanges (DEXs) on each chain individually, the aggregator optimizes token swaps for users, ensuring the best possible prices, minimal slippage, and efficient execution. This feature complements the lending and borrowing functionalities, making the Linx ecosystem a comprehensive DeFi solution.
Key Features
Dual-Chain Aggregation: The DEX aggregator operates independently on Kadena and Alephium, sourcing liquidity from DEXs native to each blockchain to provide tailored swap routes for users.
Optimal Price Execution: The aggregator scans multiple DEXs to identify the best trade routes, factoring in price, liquidity depth, and slippage, ensuring cost-effective swaps.
User-Friendly Interface: Accessible via Linx App and Linx Wallet, the aggregator provides a seamless, intuitive experience for users to execute swaps alongside lending and borrowing activities.
Fee Reinvestment Mechanism: Up to 100% of the 0.7% transaction fees accrued from swaps are reinvested into the Linx protocol through LINX token buybacks on the open market.
DEX Aggregator Mechanism
Linx Swap operates as follows:
Token Selection: Users select the tokens (on Kadena or Alephium) for their swap via the Linx App or Linx Wallet interface.
Liquidity Scanning: The aggregator queries all compatible DEXs on the selected blockchain (e.g., Mercatus on Kadena or Ayin on Alephium DEXs) to retrieve real-time liquidity data, including token pairs, pool sizes, and prices.
Route Optimization: Using a sophisticated algorithm, the aggregator calculates the optimal trade route, which may involve single-pool swaps or multi-hop routes across multiple DEXs to achieve the best price and minimize slippage.
Trade Execution: Once the user confirms the swap, the aggregator executes the transaction on the selected blockchain, leveraging smart contracts to interact with the chosen DEX(s).
Fee Collection and Reinvestment: A 0.7% fee is applied to each swap. Up to 100% of these fees are used to buy back LINX tokens from open markets on Alephium.
Chain-Specific Aggregation
Alephium: On Alephium, the aggregator connects to native DEXs, such as Elexium and those utilizing Alephium’s sharded, high-throughput blockchain. It supports pairs like ALPH/USDT, ALPH/LINX, and others, optimized for Alephium’s low-latency environment.
Isolated Operations: The aggregator operates independently on each chain, ensuring that liquidity pools and pricing data are sourced exclusively from DEXs on the selected blockchain, preserving chain-specific integrity and performance.
Fee Structure and Protocol Benefits
Swap Fee: A flat 0.7% fee is charged on each swap executed through Linx Swap DEX aggregator.
LINX Token Buyback: Up to 100% of collected fees are allocated to purchasing LINX tokens from open markets on Alephium. The exact percentage is dynamically determined based on protocol governance decisions and market conditions to maximize ecosystem value.
Reinvestment: Bought-back LINX tokens are reinvested into the Linx protocol, potentially used for:
Enhancing protocol liquidity in lending markets.
Funding rewards for lenders and borrowers.
Strengthening the protocol’s treasury for future development and stability.
Deflationary Pressure: The buyback mechanism reduces the circulating supply of LINX tokens, potentially increasing token value and aligning incentives for token holders.
Security and Transparency
Smart Contract Audits: The DEX aggregator’s smart contracts, deployed on both Kadena and Alephium, undergo rigorous audits by reputable firms to ensure security and reliability.
Immutable Execution: Swap routes are executed via immutable smart contracts, ensuring trustless and predictable outcomes.
Transparent Fee Allocation: The allocation of the 0.7% fee to LINX buybacks is publicly verifiable onchain, fostering trust among users.
Benefits for Users
Best Price Execution: Users benefit from aggregated liquidity, ensuring optimal swap prices compared to single-DEX trades.
Seamless Integration: The aggregator is embedded in the Linx App and Linx Wallet, allowing users to manage lending, borrowing, and swapping in a single interface.
Cost Efficiency: Low gas fees on Kadena and Alephium, combined with optimized trade routes, minimize transaction costs.
Protocol Growth: The LINX token buyback mechanism supports the long-term sustainability of the Linx ecosystem, benefiting all participants.
Linx Swap REST API
Linx Swap is also available as a REST API and provides developers with programmatic access to the Linx DEX Aggregator’s liquidity aggregation and swap execution capabilities on the Kadena and Alephium blockchains. This API enables seamless integration of the Linx DEX Aggregator into external applications, such as wallets, DeFi platforms, and trading bots, enhancing the composability of the Linx Lending ecosystem. By leveraging the API, developers can access optimized trade routes, execute swaps, and tap into the protocol’s liquidity aggregation across chain-native decentralized exchanges (DEXs).
API Functionality
The Linx Swap API enables developers to interact with the Linx DEX aggregator through a set of RESTful endpoints. The API operates as follows:
Chain Selection: Developers specify the target blockchain (Kadena or Alephium) in API requests to access chain-specific DEX liquidity.
Liquidity Query: The API queries available DEXs on the selected chain to retrieve real-time data on token pairs, pool sizes, and prices.
Route Optimization: The API returns the optimal trade route for a given swap, calculated by the aggregator’s algorithm to minimize cost and slippage.
Fee Handling: A 0.7% fee is applied to each swap, with up to 100% of fees allocated to LINX token buybacks on the open market, as determined by protocol governance.
Key Endpoints
The Aggregator API provides the following core endpoints (hosted at api.linxlabs.org):
POST /v1/quote: Retrieves the best trade route on Alephium for a specified token pair, amount. Parameters include tokenIn, tokenOut, amount, slippage, address and public key. (Coming soon: support for selecting blockchains)
Example: POST /v1/quote with payload
Response: JSON object with the optimal route, expected output amount, and estimated slippage.
GET /v1/tokens: Returns a list of available tokens and their metadata on the specified chain
Example: GET /v1/tokens
Response: JSON array of token data, including token (contract) id.
Security and Reliability
Rate Limiting: The API implements rate limiting to prevent abuse and ensure fair access for all developers.
Authenticated Transactions: Swap executions require signed transactions from the user’s wallet (e.g., Linx Wallet or other compatible wallets), ensuring secure and trustless operations.
Audited Smart Contracts: The underlying smart contracts for swap execution, deployed on Kadena and Alephium, are audited by reputable firms to minimize vulnerabilities.
Benefits for Developers
Seamless Integration: The RESTful API is easy to integrate into wallets, DeFi platforms, or trading bots, with documentation available at api.linxlabs.org/docs.
Access to Optimized Liquidity: Developers can offer users the best swap prices by leveraging the Linx DEX Aggregator’s routing algorithm.
Cross-Chain Flexibility: Support for both Kadena and Alephium allows developers to build applications targeting multiple blockchain ecosystems.
Benefits for the Linx Ecosystem
Increased Adoption: The API encourages third-party integrations, driving user engagement with the Linx App and Linx Wallet.
Fee Reinvestment: The 0.7% swap fees, with up to 100% allocated to LINX buybacks, enhance the protocol’s treasury and create deflationary pressure on the LINX token supply.
Composability: (Coming soon) The API enables developers to combine DEX aggregation with Linx lending and borrowing features, creating powerful DeFi workflows.
Last updated