πŸ› οΈSymbiosis API

Symbiosis API | Symbiosis Finance | Swagger

What is Symbiosis API

The Symbiosis API allows you to integrate the functionalities of the Symbiosis Protocol into your application, platform, or protocol, enabling decentralized cross-chain swaps and cross-chain liquidity management for your users.

The functionality of the Symbiosis protocol that can be integrated using the Symbiosis API
  1. Perform cross-chain operations:

    1. Cross-chain swapping (any to any token on the supported blockchain networks). An explanation in a nutshell: Cross-chain Swaps with Symbiosis.

    2. Interchain communication (any token to a third-party protocol). An explanation in a nutshell: Symbiosis as Interchain Communication Protocol.

    3. Cross-chain zapping (any token to a liquidity pool owned by Symbiosis). An explanation in a nutshell: Cross-chain Zaps and Withdrawal to/from Symbiosis Pools.

    4. Bridging (minting/burning routine). An explanation: Symbiosis Mint-Burn Process.

  2. Get statuses of cross-chain operations.

  3. Deal with emergencies (an explanation: Symbiosis & Emergencies):

    1. Get a list of stuck cross-chain operations,

    2. Generate calldata to perform reverting operation.

Checklist Before Going to Production (Mainnet)

If any of these checks fail, you put the assets of your users at risk. Therefore, you must not go to Mainnet with real assets and real users. This could result in the loss of your users' assets.

  1. Approval of ERC20 Tokens: Approve users’ ERC20 tokens only for one contract, which is 'metaRouterGateway' on each blockchain. You can verify the addresses of the contracts for all blockchains supported by Symbiosis protocol V2 in this configuration.

  2. Existence and Correct Addresses of Contracts: Ensure that all contracts used in your software exist on the corresponding blockchains and that their addresses on each blockchain match those in this configuration.

  3. Handling of Calldata: Do not modify, reuse, or cache the calldata obtained from calling methods of the Symbiosis SDKs and API.

  4. Acknowledgement of 'from' Address Usage: Acknowledge that the 'from' address is used to revert a cross-chain swap if the cross-chain operation gets stuck. For more information see #address-eligible-to-revert-cross-chain-swaps

  5. Testing: After deployment to Mainnet, run at least one cross-chain operation.

Please do these checks for the initial deployment AND each software update.

Understanding the Symbiosis Protocol

The most crucial parts for understanding the Symbiosis protocol are:

Supported Blockchains and Tokens

Supported blockchains

Values such as chain IDs for the supported blockchains are listed in the following configurations:

You can also get a list of supported blockchains using the '/v1/chains' endpoint to get a list of currently supported blockchains.

Supported tokens

Using the Symbiosis API, you can operate any token that exists and can be exchanged in DEXes on the blockchains supported by the Symbiosis protocol. We have no restrictions on the tokens to operate. You may consider composing your own list of supported tokens if you need to.

Address Eligible to Revert Cross-chain Operations

In certain situations, a cross-chain operation may fail to complete. Various reasons could cause this failure. To address such scenarios, the Symbiosis protocol provides methods to revert stuck cross-chain operations.

Important: Only the address specified as 'from' in the original cross-chain operation can revert the operation if it gets stuck. The two possible scenarios for specifying the 'from' address are:

  1. The User's Address as the 'from' Address: If a cross-chain operation gets stuck, the user can revert the operation using the Symbiosis WebApp.

  2. Your Contract's Address as the 'from' Address: If you choose this option, your contract must include methods to perform reverts.

For an explanation of emergencies, see Symbiosis & Emergencies

Swaggers

Testnet: Please note, we do not guarantee functionality of the Symbiosis API on Testnet.

Examples

Symbiosis WebApp

Symbiosis WebApp employs the Symbiosis API for its interactions with the Symbiosis protocol and can be used as a reference for existing protocol functionality.

Swagger

The swaggers of the Symbiosis API:Swagger contain examples of using every endpoint. Just scroll down to the endpoint you are interested in, enter the needed data or select it from the preset data and run an example.

Last updated