Memo Strings
Limora uses structured memo strings to encode transaction intent and parameters. This page documents the memo format for various operations.
Overview
Memo strings are included in transaction data to specify the intended operation and its parameters. The protocol parses these memos to execute the correct logic.
Most users interact with Limora through the web interface, which automatically
constructs the correct memo strings. This documentation is primarily for
developers and advanced users building integrations.
All memo strings follow a structured format:
OPERATION:PARAM1:PARAM2:...:PARAMN
OPERATION : The action to perform
PARAMS : Colon-separated parameters specific to the operation
Trade Operations
Open Long Position
OPEN_LONG:PAIR:LEVERAGE:STOP_LOSS:TAKE_PROFIT
Parameter Type Description PAIR string Trading pair (e.g., “BTC-USDC”) LEVERAGE number Leverage multiplier (2-100) STOP_LOSS number Stop-loss price (0 for none) TAKE_PROFIT number Take-profit price (0 for none)
Example:
OPEN_LONG:BTC-USDC:10:45000:60000
Opens a 10x long BTC position with stop-loss at 45 , 000 a n d t a k e − p r o f i t a t 45,000 and take-profit at 45 , 000 an d t ak e − p ro f i t a t 60,000.
Open Short Position
OPEN_SHORT:PAIR:LEVERAGE:STOP_LOSS:TAKE_PROFIT
Parameter Type Description PAIR string Trading pair (e.g., “ETH-USDC”) LEVERAGE number Leverage multiplier (2-100) STOP_LOSS number Stop-loss price (0 for none) TAKE_PROFIT number Take-profit price (0 for none)
Example:
OPEN_SHORT:ETH-USDC:5:3500:2800
Opens a 5x short ETH position with stop-loss at 3 , 500 a n d t a k e − p r o f i t a t 3,500 and take-profit at 3 , 500 an d t ak e − p ro f i t a t 2,800.
Close Position
Parameter Type Description TRADE_ID string Unique identifier of the trade to close
Example:
CLOSE_TRADE:0x1234567890abcdef
Cancel Pending Trade
Parameter Type Description TRADE_ID string Unique identifier of the pending trade
Example:
CANCEL_TRADE:0xabcdef1234567890
Matching Operations
Deposit to Match Pool
Parameter Type Description TOKEN string Token symbol to deposit (e.g., “USDC”)
Example:
Match a Trade
Parameter Type Description TRADE_ID string Unique identifier of the trade to match
Example:
MATCH_TRADE:0x1234567890abcdef
Withdraw from Match Pool
WITHDRAW_MATCH:TOKEN:AMOUNT
Parameter Type Description TOKEN string Token symbol to withdraw AMOUNT number Amount to withdraw (use “MAX” for full balance)
Example:
Balance Operations
Deposit Collateral
Parameter Type Description TOKEN string Token symbol being deposited
Example:
Withdraw Collateral
Parameter Type Description TOKEN string Token symbol to withdraw AMOUNT number Amount to withdraw
Example:
Encoding Rules
Use decimal notation without thousands separators
Maximum 18 decimal places for precision
Use “0” for optional parameters that should be disabled
# Good
OPEN_LONG:BTC-USDC:10:45000.50:60000
# Bad
OPEN_LONG:BTC-USDC:10:45,000.50:$60,000
Use uppercase for operation names
Use uppercase for token symbols
Trading pairs use hyphen separator (e.g., “BTC-USDC”)
Special Values
Value Meaning 0 Disabled (for optional parameters) MAX Maximum available amount MARKET Current market price
Error Handling
Invalid memo strings will cause transaction rejection. Common errors:
Error Cause INVALID_OPERATION Unknown operation type MISSING_PARAM Required parameter not provided INVALID_PARAM Parameter value out of range INVALID_PAIR Trading pair not supported INSUFFICIENT_BALANCE Not enough funds for operation
Code Examples
JavaScript/TypeScript
// Construct a memo for opening a long position
function buildOpenLongMemo (
pair : string ,
leverage : number ,
stopLoss : number = 0 ,
takeProfit : number = 0
) : string {
return `OPEN_LONG: ${ pair } : ${ leverage } : ${ stopLoss } : ${ takeProfit } `
}
// Example usage
const memo = buildOpenLongMemo ( 'BTC-USDC' , 10 , 45000 , 60000 )
// Result: "OPEN_LONG:BTC-USDC:10:45000:60000"
Python
def build_open_long_memo (
pair : str ,
leverage : int ,
stop_loss : float = 0 ,
take_profit : float = 0
) -> str :
return f "OPEN_LONG: { pair } : { leverage } : { stop_loss } : { take_profit } "
# Example usage
memo = build_open_long_memo( "BTC-USDC" , 10 , 45000 , 60000 )
# Result: "OPEN_LONG:BTC-USDC:10:45000:60000"
Versioning
The memo format may be updated as the protocol evolves. Current version: v1.0
Future versions will maintain backward compatibility where possible. Breaking changes will be announced in advance through official channels.
API Reference See the full API documentation for programmatic access.