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.
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):
import { initFerraSDK } from '@ferra-labs/dlmm'
const sdk = initFerraSDK({
network: 'testnet',
wallet: '0x...your_wallet_address'
})
Basic Usage Pattern
// 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:
- Factory (
sdk.Factory) - Creating and managing trading pairs - Pair (
sdk.Pair) - Liquidity pool operations and pair information - Position (
sdk.Position) - Opening, closing, and managing positions - Swap (
sdk.Swap) - Token swapping with rate calculations - 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:
- Creating a New Trading Pair
- Adding Liquidity to a Pair
- Swapping Tokens
- Managing Positions
- Getting Active Bin Information
Testing
The package includes comprehensive test examples. You can run them with:
# 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.,
**/*.tsfor 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:
- Check the test files first - they contain working examples
- Review the reference files - they provide detailed explanations
- Follow the workflows - step-by-step guides for common tasks
- 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.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated 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.
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.
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.
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.
sui-client
Interact with Sui blockchain using @mysten/sui SDK. Use when building transactions, reading chain data, or managing staking positions on Sui.
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.
Didn't find tool you were looking for?