Agent skill

working-with-ferra-dlmm

Helps developers work with the Ferra DLMM SDK for Discrete Liquidity Market Maker operations on Sui blockchain. Provides guidance on SDK initialization, pair creation, liquidity management, token swaps, and position handling. Use when working with DLMM pairs, adding/removing liquidity, creating trading pairs, or performing token swaps in the ferra-sdks monorepo.

Stars 5
Forks 1

Install this agent skill to your Project

npx add-skill https://github.com/RandyPen/sui-eco-skills/tree/main/ferra-dlmm

SKILL.md

Working with Ferra DLMM SDK

This skill helps you work with the Ferra Discrete Liquidity Market Maker (DLMM) SDK for Sui blockchain. The SDK provides tools for liquidity management, pair creation, token swapping, and position handling in DLMM pools.

Overview

The @ferra-labs/dlmm package is a TypeScript SDK for interacting with Discrete Liquidity Market Maker protocols on Sui. It supports:

  • Factory operations: Creating new trading pairs
  • Pair management: Fetching pair data and managing liquidity pools
  • Position handling: Opening, closing, and managing liquidity positions
  • Swap operations: Token swapping with precise price calculations
  • Quoter utilities: Price quoting and calculation tools

Quick Start

SDK Initialization

Initialize the SDK with a specific network (mainnet, testnet, beta):

typescript
import { initFerraSDK } from '@ferra-labs/dlmm'

const sdk = initFerraSDK({
  network: 'testnet',
  wallet: '0x...your_wallet_address'
})

Basic Usage Pattern

typescript
// Get a pair by its address
const pair = await sdk.Pair.getPair(pairAddress)

// Check current active bin
const activeId = pair.parameters.active_id
console.log(`Current active bin ID: ${activeId}`)

Core Modules

The SDK is organized into these main modules:

  1. Factory (sdk.Factory) - Creating and managing trading pairs
  2. Pair (sdk.Pair) - Liquidity pool operations and pair information
  3. Position (sdk.Position) - Opening, closing, and managing positions
  4. Swap (sdk.Swap) - Token swapping with rate calculations
  5. Quoter (sdk.Quoter) - Price quoting utilities

Common Patterns

For detailed guidance on specific operations, refer to these reference files:

  • SDK Setup and Configuration
  • Pair Operations and Liquidity Management
  • Swap Operations and Price Calculations
  • Position Management
  • Test Examples and Usage Patterns

Workflows

Step-by-step guides for common tasks:

  1. Creating a New Trading Pair
  2. Adding Liquidity to a Pair
  3. Swapping Tokens
  4. Managing Positions
  5. Getting Active Bin Information

Testing

The package includes comprehensive test examples. You can run them with:

bash
# Navigate to the dlmm package
cd packages/dlmm

# Run specific test files
bun test add-liquidity.ts
bun test create-pair.ts
bun test swap.ts

Test files are located in packages/dlmm/tests/ and provide working examples of all major operations.

Tool Usage

This skill allows the following tools:

  • Read: Access files in the codebase to understand implementation details
  • Glob: Find files by pattern (e.g., **/*.ts for TypeScript files)
  • Grep: Search for specific code patterns or function definitions
  • Bash: Execute test commands and scripts

Getting Help

When working with the DLMM SDK:

  1. Check the test files first - they contain working examples
  2. Review the reference files - they provide detailed explanations
  3. Follow the workflows - step-by-step guides for common tasks
  4. Examine the source code - use Read/Glob/Grep tools to explore

Key Concepts

  • Discrete Liquidity: Liquidity is concentrated in specific price ranges (bins)
  • Active Bin: The current price bin where trading occurs
  • Bin Step: The percentage difference between adjacent bins
  • Distribution Strategies: How liquidity is allocated across bins (BID_ASK, etc.)

Start with the SDK Setup reference for detailed initialization instructions.

Expand your agent's capabilities with these related and highly-rated skills.

RandyPen/sui-eco-skills

sui-transaction-building

Helps Claude Code understand Sui blockchain transaction building, providing guidelines and examples for Transaction class, commands, input types, gas configuration, and serialization. Use when building blockchain transactions on Sui or when the user mentions transaction building, Transaction class, or Move calls.

5 1
Explore
RandyPen/sui-eco-skills

sui-keypair-cryptography

Helps Claude Code understand Sui blockchain keypair and cryptography operations, providing guidelines and examples for key generation, signing, verification, address derivation, and multi-signature scheme support. Use when working with cryptography in Sui development or when the user mentions keypairs, cryptography, signing, or verification.

5 1
Explore
RandyPen/sui-eco-skills

deepbook-trading

Helps Claude Code understand DeepBook V3 SDK usage for order book trading, flash loans, fund management, and market data queries on Sui blockchain. Use when operating DeepBook DEX, executing trading strategies, or querying market data.

5 1
Explore
RandyPen/sui-eco-skills

deepbook-margin-trading-skill

Guides developers through using DeepBook V3 Margin Trading SDK for leverage trading, borrowing, lending, liquidation operations, and risk management on Sui blockchain. Use when working with DeepBook margin trading, margin pools, margin managers, take profit/stop loss orders, or liquidation functionality.

5 1
Explore
RandyPen/sui-eco-skills

sui-client

Interact with Sui blockchain using @mysten/sui SDK. Use when building transactions, reading chain data, or managing staking positions on Sui.

5 1
Explore
RandyPen/sui-eco-skills

cetus-dlmm-interface

Enables Claude to effectively work with the Cetus Dynamic Liquidity Market Maker (DLMM) protocol on Sui blockchain. This skill provides comprehensive knowledge of the DLMM architecture, Move smart contracts, Rust SDK, and development workflows. Claude can assist with building, testing, and modifying DLMM contracts, creating swap simulations, implementing new features, and debugging protocol issues. The skill covers all 15 Move modules, multi-bin architecture, reward distribution, ACL system, and flash swap functionality. Trigger contexts include: working with Sui Move smart contracts for decentralized exchanges, implementing dynamic liquidity management, creating multi-bin AMM protocols, building swap simulations with Rust SDK, modifying DLMM protocol parameters, debugging pool operations, implementing reward systems, and working with Cetus DLMM interface codebase.

5 1
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results