CompX Documentation
  • Welcome to CompX
    • Connecting to CompX
  • Portfolio Tracking
    • Portfolio Tracking Overview
  • Swap Router
    • Swap Router Overview
    • The CompX Router
    • CompX Router Layout
    • Performing a Swap
    • Minting fAssets
  • Token Streams
    • Token Streams Overview
      • Token stream UI
      • Receiving a Token Stream
      • Creating Token Streams
  • X-NFT
    • X-NFT Overview
    • X-NFT Current Status
  • xUSD
    • Overview
      • Vault Design
    • Tokenomics
      • Stability Mechanisms
        • Variable Interest Rate
        • xUSD Staking
      • Liquidation
        • Liquidation Example
        • Performing a Liquidation
      • Borrowing xUSD
      • Managing Debt
  • Staking pools
    • STAKING at CompX
    • Algorand Consensus Staking Overview
      • CompX Consensus Implementation
      • Understanding LSTs
      • Using CompX cAlgo
    • Using Time Locked Contracts
    • Using Injected Liquidity Contracts
    • Genesis Pools
      • Creating a Genesis Pool
      • Staking in a Genesis Pool
  • Governance
    • CompX Governance-Flux
    • Proposals
    • Voting
    • Maximizing Voting Power
  • Rewards
    • Overview
    • Earning Points
Powered by GitBook
On this page
  1. Swap Router

Performing a Swap

PreviousCompX Router LayoutNextMinting fAssets

Last updated 6 months ago

Set swap parameters

In the section labeled "FROM", select the asset to be used for the purchase. To the right there are several buttons labeled with percentages ranging from 25% to 100%. These act as a quick select option for choosing how much of the selected asset will be swapped. If the preset options aren't sufficient, a custom amount of the "sale" token can be entered in the appropriate field.

In the section labeled "TO", the user selects the token to receive in return. Once this is selected, the router will begin searching the dexes for an optimal swap route. It will be apparent that a solution has been found, when the amount of the "purchase" token auto-fills. As an alternative, the user can manually enter an amount of the "purchase" token, and the amount of the "sale" token will auto-populate to the appropriate amount. To see the actual route that will be used to perform the swap, click on the yellow bar at the bottom of the page that says "Summary of the swap" to expand the information window. In the case that a single pool swap yields the best results, no fees will need to be assessed by the CompX router, because it hasn't added any value to the swap. The only fees will be Algorand network fees. If dex routing is being used, the 0.02% fee will be charged to perform the swap. Fees are included in the routing cost calculation.

Performing the swap

Below the now expanded information window, is the swap button. A pop up window titled "Confirm Transaction" will pop up and summarize the process. After reviewing the swap, tap or click the swap button. A pop up window will appear outlining the swap process.

If the token that's being received hasn't been opted into in the users wallet, the first step will be to perform that opt-in. To opt in, click "Sign Transactions" and sign the transaction with the wallet of your choice. After that's completed the GUI will advance to the actual swap. If the asset is already opted in, it will progress automatically to the "Swap" step. To complete the swap press "Sign Transactions" again and sign the prepared transaction. The GUI will then move to "Completed" after the swap finalizes on chain. You should be alerted to the sold assets leaving your wallet, and the new bought asset arriving in your wallet.

Swap confirmation pop up window