Overview

The DeFi Engine SDK helps developers to more easily build DeFi applications on the R5 Network. It can run in any environment that can execute JavaScript (apps, website, scripts, etc).

It consolidates an engine comprised of 3 main components:

  • The DeFi Engine SDK, that can be used to build decentralised finance applications wieh ease.

  • The Pair Factory Smart Contract, responsible for handling liquidity of new exchange pairs.

  • The Router Smart Contract, that can be used - optionally - to handle the routing of swaps to execute trades using an Automated Market Making Mechanism (AMM).

Installation

The easiest way to install the R5 DeFi Engine SDK is via npm. In your application, you can install it with the following command:

npm install r5-defi-engine

Usage

ES6 Example

/**
 * Import ChainId from the R5 DeFi Engine SDK
 */
import { ChainId } from "r5-defi-engine";
/**
 * Display R5 mainnet chain ID
 */
console.log(`R5 Mainnet Chain ID: ${ChainId.R5}.`)

CommonJS Example

/**
 * Use "require" to set the DEFI_ENGINE constant
 */
const DEFI_ENGINE = require("r5-defi-engine")
/**
 * Display R5 mainnet chain ID
 */
console.log(`R5 Mainnet Chain ID: ${DEFI_ENGINE.ChainId.DR5}.`)

Last updated