Skip to main content

DeFi Overview

Introduction

Changelly DeFi Swap is an open liquidity layer that connects fragmented liquidity across multiple blockchains and providers. It enables users to swap any token to any token across Ethereum, Solana, Tron, Bitcoin and other networks through a single unified execution layer. More information about our product on the Changelly website. For complete terms and conditions governing the use of the API, please refer to the Changelly DeFi Terms of Use.

Base DeFi API resource: https://defiapi.changelly.com/.


Key features

  • Cross-Chain Swaps: Swap tokens between Ethereum, Solana, Tron, Bitcoin and other networks.
  • Best Execution: Smart routing analyzes all available paths to minimize costs.
  • Different deposit scenarios to initiate a swap.
  • Universal Access: Swap any supported token across any supported chain.
  • Non-Custodial: Users maintain control of their assets throughout the swap process.

Deposit scenarios

Supports multiple crypto funding scenarios to initiate a swap:

  • Offchain: An intent-based flow where the user signs a swap intention off-chain, authorizing the resolver's smart contract to deduct funds from their wallet via specialized mechanisms.
  • Onchain: The swap transaction is directly signed and submitted to the network by the wallet holder.
  • Deposit: A scenario where the user receives a unique resolver address to transfer funds via an on-chain transaction to start the DeFi swap.

Affiliate fees

A few DeFi API methods retrieves the Fees object with information about partner and Changelly extra fee. You have options to set your reward amount:

info

The custom affiliate fee value in basis points must be in increments of 5 (or 0.05%) and cannot exceed 3% (300 bps).


User Flow

The process involves two main participants: the user, who initiates the swap, and the resolver, who executes it.

  1. Quote Request. The swap process starts with a quote request. The user specifies the currency pair they would like to swap, one of the deposit scenarios and the amount. The client sends these parameters to the Changelly DeFi Quote API. The API returns a quote, a time-limited execution estimate that includes all pricing information.
info

If the desired token is not in the list of available, you can provide a custom contract address and network_id to request a quote.

  1. Swap Intent Creation. After receiving a quote, the client creates an intent, a structured representation of the user's swap intention, by specifying the user's addresses and the quote identifier the user agreed to. This represents the user's intention to execute the swap under the quoted conditions. Swap intents are chain-agnostic and support multiple blockchains and approval mechanisms.

  2. Signing a Swap Intent. After intent creation, the API provides all the necessary information for the user to sign the swap. The user signs the intent off-chain, cryptographically approving the swap parameters defined in the intent and authorizing resolvers to execute it according to the quoted conditions.

  3. Execution. Once the user has signed an intent, the system notifies the winning resolver to start swap execution by depositing the maker's assets into an escrow contract on the source chain and then transferring the corresponding assets to the user. During execution, the user can query the Changelly DeFi Intent API to retrieve the swap status.