# RUJI Product Integration Guides

### Available Guides

#### [RUJI Trade and CCL](/developers/ruji-product-integration-guides/ruji-trade-and-ccl.md)

Integrate RUJI Trade orderbook DEX with native assets (BTC, ETH, SOL, XRP, DOGE, BCH, LTC and more) secured by THORChain - fully decentralized and permissionless.

* [**Funding Requirement: Secured Assets**](https://docs.rujira.network/developers/ruji-product-integration-guides/ruji-trade-and-ccl#funding-requirement-secured-assets)
  * Deposit native assets into THORChain to get Secured Assets
  * Withdraw Secured Asset back to the source L1
* [**Trading on RUJI Trade (FIN)**](/developers/ruji-product-integration-guides/ruji-trade-and-ccl.md#swap-integration)
  * Market orders (swap)
  * Limit orders
  * Tracking orders
* [**Custom Concentrated Liquidity (CCL) Positions**](/developers/ruji-product-integration-guides/ruji-trade-and-ccl.md#ccl-range-integration)
  * Create and manage ranges (fixed-range AMM strategies built directly into FIN)

#### [Money Market](/developers/ruji-product-integration-guides/ruji-lend-and-borrow.md)

Integrate lending and borrowing functionality with native assets (BTC, ETH, SOL, XRP, DOGE, BCH, LTC and more) secured by THORChain.

* [**Lending (Ghost Vault)**](/developers/ruji-product-integration-guides/ruji-lend-and-borrow.md#part-1-lending-integration-ghost-vault)
  * Deposit assets to earn yield
  * Receive transferable receipt tokens
  * Dynamic interest rates based on utilization
* [**Borrowing (Ghost Credit)**](/developers/ruji-product-integration-guides/ruji-lend-and-borrow.md#part-2-borrowing-integration-ghost-credit)
  * Create isolated Credit Accounts
  * Deposit multi-asset collateral
  * Borrow against collateral with overcollateralized loans

#### [Liquidations](/developers/ruji-product-integration-guides/ruji-liquidations.md)

* [**Bidding on Liquidations (for end users)**](/developers/ruji-product-integration-guides/ruji-liquidations/bidding-on-liquidations.md)
  * Integrate liquidation bidding into your application, allowing users to acquire collateral at discounted prices when CDP positions are liquidated.
* [**Build a Liquidation Solver (for developers)**](/developers/ruji-product-integration-guides/ruji-liquidations/liquidation-solvers.md)
  * Build liquidation bots that monitors at-risk positions, calculates optimal liquidation routes, and executes liquidations to earn the 0.5% executor fee.

***

### Quick Reference

#### Main Supported Assets

<table><thead><tr><th width="150">Asset</th><th width="400">Denom</th><th>Decimals</th></tr></thead><tbody><tr><td>BTC</td><td><code>btc-btc</code></td><td>8</td></tr><tr><td>ETH</td><td><code>eth-eth</code></td><td>8</td></tr><tr><td>USDC</td><td><code>eth-usdc-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48</code></td><td>8</td></tr><tr><td>USDT</td><td><code>eth-usdt-0xdac17f958d2ee523a2206206994597c13d831ec7</code></td><td>8</td></tr><tr><td>BCH</td><td><code>bch-bch</code></td><td>8</td></tr><tr><td>DOGE</td><td><code>doge-doge</code></td><td>8</td></tr><tr><td>LTC</td><td><code>ltc-ltc</code></td><td>8</td></tr><tr><td>XRP</td><td><code>xrp-xrp</code></td><td>8</td></tr><tr><td>BNB</td><td><code>bsc-bnb</code></td><td>8</td></tr><tr><td>AVAX</td><td><code>avax-avax</code></td><td>8</td></tr><tr><td>TRX</td><td><code>tron-trx</code></td><td>8</td></tr><tr><td>ATOM</td><td><code>gaia-atom</code></td><td>8</td></tr></tbody></table>

> **Note:** For the full list of supported assets and chains, check THORChain active pools on <https://thorchain.net/pools/main>.

#### Network Endpoints

**THORChain Mainnet**

<table><thead><tr><th width="300">Type</th><th>URL</th></tr></thead><tbody><tr><td>RPC</td><td><code>https://gateway.liquify.com/chain/thorchain_rpc</code></td></tr><tr><td>gRPC</td><td><code>https://grpc-thorchain.rorcual.xyz</code></td></tr><tr><td>REST</td><td><code>https://gateway.liquify.com/chain/thorchain_api</code></td></tr></tbody></table>

**Rujira APIs**

<table><thead><tr><th width="300">Environment</th><th>URL</th></tr></thead><tbody><tr><td>Mainnet GraphQL</td><td><code>https://api.rujira.network/api/graphiql</code></td></tr></tbody></table>

***

### Development Tools

#### Libraries

RUJI contracts are standard CosmWasm. Use any Cosmos SDK compatible library:

| Language              | Library                                               |
| --------------------- | ----------------------------------------------------- |
| TypeScript/JavaScript | [CosmJS](https://github.com/cosmos/cosmjs)            |
| Rust                  | [cosmwasm-std](https://crates.io/crates/cosmwasm-std) |
| Go                    | [Cosmos SDK](https://github.com/cosmos/cosmos-sdk)    |
| Python                | [cosmpy](https://github.com/fetchai/cosmpy)           |

#### Contract Schemas

JSON schemas for all message types are available in each contract's `/schema` directory:

* [RUJI Trade (FIN) Schema](https://gitlab.com/thorchain/rujira/-/blob/main/contracts/rujira-fin/schema/rujira-fin.json?ref_type=heads)
* [Ghost Vault Schema](https://gitlab.com/thorchain/rujira/-/blob/main/contracts/rujira-ghost-vault/schema/rujira-ghost-vault.json?ref_type=heads)
* [Ghost Credit Schema](https://gitlab.com/thorchain/rujira/-/blob/main/contracts/rujira-ghost-credit/schema/rujira-ghost-credit.json?ref_type=heads)

***

### Common Patterns

#### Querying Contract State

```typescript
import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";

const client = await CosmWasmClient.connect("https://rpc.ninerealms.com");

// Query any contract
const result = await client.queryContractSmart(
  CONTRACT_ADDRESS,
  { query_msg: { /* params */ } }
);
```

#### Executing Transactions

```typescript
import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate";

const client = await SigningCosmWasmClient.connectWithSigner(
  "https://rpc.ninerealms.com",
  signer
);

// Execute with funds
const result = await client.execute(
  senderAddress,
  CONTRACT_ADDRESS,
  { execute_msg: { /* params */ } },
  "auto",  // gas
  "",      // memo
  [{ denom: "btc-btc", amount: "100000000" }]  // funds
);
```

#### Handling Decimals

All amounts use 8 decimal places:

```typescript
// Convert human-readable to chain format
function toChainAmount(amount: number): string {
  return Math.floor(amount * 1e8).toString();
}

// Convert chain format to human-readable
function fromChainAmount(amount: string): number {
  return parseInt(amount) / 1e8;
}

// Examples:
toChainAmount(1.5);        // "150000000" (1.5 BTC)
fromChainAmount("100000000"); // 1.0 BTC
```

***

### Support

* **Documentation**: [docs.rujira.network](https://docs.rujira.network)
* **Telegram**: [@Rujira\_Community ](https://t.me/Rujira_Community)
* **E-Mail**: [bd@rujira.network ](mailto://bd@rujira.network)
* **Discord**: [Join](https://discord.gg/AfmZN49grz)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rujira.network/developers/ruji-product-integration-guides.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
