Use Orca
The Use Orca
tool, part of AgentiPy, allows users to interact with the Orca decentralized exchange protocol on Solana. It provides functionalities for managing liquidity positions, specifically creating Concentrated Liquidity Market Maker (CLMM) pools, creating single-sided liquidity pools, opening centered and single-sided positions, fetching existing positions, and closing positions. These operations are routed through an Agentipy proxy service.
Functionality
This tool is implemented in the OrcaManager
class. All its methods interact with an Agentipy proxy service (agent.base_proxy_url
), sending encrypted private keys and an OpenAI API key with each request.
Key Methods:
create_clmm(agent: SolanaAgentKit, mint_deploy: str, mint_pair: str, initial_price: float, fee_tier: str) -> Optional[Dict[str, Any]]
:Creates a new CLMM pool on Orca.
Parameters:
mint_deploy
(base token),mint_pair
(quote token),initial_price
, andfee_tier
.
create_liquidity_pool(agent: SolanaAgentKit, deposit_token_amount: float, deposit_token_mint: str, other_token_mint: str, initial_price: float, max_price: float, fee_tier: str) -> Optional[Dict[str, Any]]
:Creates a single-sided liquidity pool. Parameters define the deposit token, the other token in the pair, and the price range (
initial_price
,max_price
).
open_centered_position(agent: SolanaAgentKit, whirlpool_address: str, price_offset_bps: int, input_token_mint: str, input_amount: float) -> Optional[Dict[str, Any]]
:Opens a liquidity position centered around the current price in an existing Orca Whirlpool (
whirlpool_address
).price_offset_bps
defines the range width around the current price.
open_single_sided_position(agent: SolanaAgentKit, whirlpool_address: str, distance_from_current_price_bps: int, width_bps: int, input_token_mint: str, input_amount: float) -> Optional[Dict[str, Any]]
:Opens a single-sided liquidity position, typically outside the current active price range.
fetch_positions(agent: SolanaAgentKit) -> Optional[Dict[str, Any]]
:Fetches all open Orca liquidity positions for the agent's wallet.
close_position(agent: SolanaAgentKit, position_mint_address: str) -> Optional[Dict[str, Any]]
:Closes an existing Orca liquidity position identified by its
position_mint_address
.
All methods return a dictionary with the transaction details from the proxy or an error.
Important Considerations:
Proxy Service: This tool relies on an Agentipy proxy service. The availability, authentication (including the role of the OpenAI API key), and terms of use for this proxy are critical.
On-Chain Financial Transactions: All methods involving creating pools, opening positions, or closing positions are significant on-chain actions that will spend/lock tokens and incur SOL fees.
Orca Protocol Knowledge: Users should have a strong understanding of Orca's Whirlpools (CLMMs), including concepts like fee tiers, price ranges, liquidity provision, and impermanent loss, before using these tools with real assets.
Parameter Accuracy: Correct mint addresses, whirlpool addresses, fee tiers, and price range parameters are crucial for successful and intended operations.
Source Code
You can find the source code for this tool on GitHub: https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_orca.py
Last updated