R5 Network
WebsiteR5 LabsGitHub
  • Getting Started
    • Hello & Welcome!
  • About R5
    • Overview
    • R5 Components
    • Consensus Mechanism
    • zkNet (Privacy)
  • R5 Coin
  • R5 Tokenomics
  • Tutorials & Guides
    • Connect & Use R5
      • R5 Desktop Wallet
      • MetaMask
      • Rabby Wallet
      • Coinbase Wallet
    • zkNet Web Wallet
    • R5 Desktop Wallet
      • Interface Overview
      • Send a Transaction
      • Receive a Transaction
      • Backup Your Wallet
      • Retrieve Your Private Key
    • How To: Deploy a Node
    • How To: Mine R5
    • How To: GPU Mine R5
    • How To: Build R5 From Source
    • How To: Connect Local Nodes
  • For Developers
    • R5 SDK
      • R5 Relayer
      • R5 Console
      • JS Console
      • CLI Wallet
      • SCdev
      • SSL Proxy
    • Hardware Requirements
    • R5 Testnet
    • R5 Devnet
    • Local Networks
    • JSON-RPC API
      • admin
      • debug
      • ethash
      • miner
      • net
      • r5 (eth)
      • rpc
      • txpool
      • web3
    • Indexer API
    • zkNet API
    • DeFi Engine SDK
      • Overview
      • Price Fetching
      • Trade Entity
      • Smart Contract Addresses
    • Node Configuration
    • Ethash-R5
    • Smart Contracts
    • Wrapped R5 (Native)
    • Tokens & NFTs
  • Bug Bounty Program
  • Resources
    • Website
    • R5 Labs
    • R5 Labs GitHub
Powered by GitBook
On this page
  • Installation
  • Usage
  1. For Developers
  2. DeFi Engine SDK

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}.`)
PreviousDeFi Engine SDKNextPrice Fetching

Last updated 1 day ago