SDK Architecture

Rubic’s SDK is being constantly improved and streamlined on all levels.

Rubic’s SDK is a Cross-Chain tool & service with a unique architecture that provides the ultimate cross-chain swapping experience both for its users and integrators.

Overall, the architecture of the protocol is based on three parts: the core SDK modules, the modules related to external API (providers, CoinGecko), and the blockchain Interaction module (RPC Node).

  1. Rubic’s SDK, which is also deployed in its main app, consists of the following modules: Cross-Chain Manager, On-Chain Manager, Status Manager, Token Manager, and Revert Manager.

  2. Rubic’s SDK interacts with blockchains through the RPC Node. Rubic’s SDK accesses blockchain nodes to retrieve blockchain meta-information, invoke smart contracts, or send transactions.

  3. Cross-Chain Manager incorporates on-chain swaps as well. To find the best swap option and build up the optimal route, Rubic’s SDK reaches out to the providers’ API, and then the transaction is sent to Rubic’s smart contracts, which call the contracts of cross-chain providers, in return.

  4. On-Сhain Manager implies instant trades and means that you swap tokens on the same blockchain. To deliver transaction data and rates, Rubic appeals to 0x and 1inch as on-chain providers via external API. For the rest of the providers, Rubic receives the data from the blockchain through the RPC Node.

  5. Status Manager module provides the status of a cross-chain swap and is connected to the ‘My Trades’ section shown on app.rubic.exchange. In the cases of Celer and DeBridge, Status Manager reaches directly to the smart contract. Simbiosis and LIFI call their API. Finally, the Status Manager gets back with the ultimate status of a transaction.

  6. Token Manager module keeps the information about tokens and interacts with CoinGecko to receive the USD value of each of them.

  7. Revert Manager ensures the operation of the auto-refund function. If any error occurs in a transaction, the funds are saved in the form of transit tokens, and afterward, get back to their owners. In the case of Symbiosis, Rubic’s SDK contacts the Symbiosis Revert API. On Rubic’s app, it’s being realized through the “My Trades” section — “Recent Trades”. If a trade hasn’t been completed in the target network, users will see “Revert Transaction.”

Last updated