Overview & Architecture
Keepx is a high-performance concentrated liquidity (CLMM) management suite engineered for Solana. Traditional Automated Market Makers (x × y = k) disperse capital uniformly across the entire price curve from zero to infinity. Concentrated liquidity allows liquidity providers (LPs) to allocate capital inside specific price intervals ([P_lower, P_upper]), yielding up to 50x greater fee efficiency.
[Solana RPC] <---> [Keepx App (Browser)] <---> [Solana Wallet Adapter]
| | |
Live Tick Array Pre-Flight Simulation Phantom / Solflare
& Pool Metadata & Slippage Guard Local Transaction SignNon-Custodial Signing Pipeline
Every transaction crafted by Keepx requires explicit approval and signing by the user’s connected Solana wallet. Keepx never holds, routes, or proxies user funds.
The execution lifecycle follows four strict boundaries:
Wallet adapter authenticates the public key as the position authority. No custodial permissions requested.
Selected price bounds are snapped to valid Raydium tick spacings to ensure mathematical accuracy.
The transaction is simulated against the latest Solana slot to verify balance constraints and compute fee estimation.
Transaction is broadcasted via high-speed RPC and verified via block commitment logs.
Raydium SDK V2 Boundary & Methods
Keepx leverages the official @raydium-io/raydium-sdk-v2 library. To ensure fault isolation, all SDK operations are encapsulated inside dedicated handler services.
raydium.clmm.getPoolInfoFromRpc(poolId: string)Fetches live on-chain pool metadata, current tick index, square root price, fee growth globals, and active tick spacing directly from Solana RPC.
raydium.clmm.getRpcClmmPoolInfo({ poolId })Extracts atomic tick arrays and pool state required to compute accurate lower and upper boundary liquidity equations.
raydium.clmm.getOwnerPositionInfo({ poolId })Scans the connected wallet's token accounts to retrieve all position NFT mints, locked liquidity amounts, and accrued unclaimed fees.
raydium.clmm.openPositionFromBase({ poolInfo, tickLower, tickUpper, baseAmount })Constructs the exact concentrated liquidity position instructions, computing necessary token transfers and NFT mint allocation.
raydium.clmm.decreaseLiquidity({ poolInfo, positionInfo, liquidity })Generates atomic withdrawal instructions to unlock principal liquidity and collect accrued fee tokens back to the signer's wallet.
raydium.clmm.closePosition({ poolInfo, positionInfo })Burns the position NFT, returns rent exemption lamports to the owner wallet, and finalizes closure on-chain.
import { Raydium, ClmmPoolInfo } from "@raydium-io/raydium-sdk-v2";
import { PublicKey } from "@solana/web3.js";
import BN from "bn.js";
export async function openRangePosition({
raydium,
poolInfo,
tickLower,
tickUpper,
baseAmount,
}: {
raydium: Raydium;
poolInfo: ClmmPoolInfo;
tickLower: number;
tickUpper: number;
baseAmount: BN;
}) {
// Construct CLMM position instructions
const { execute, transaction } = await raydium.clmm.openPositionFromBase({
poolInfo,
tickLower,
tickUpper,
baseAmount,
otherAmountMax: new BN(0),
checkCreateATAOwner: true,
});
return { execute, transaction };
}Concentrated Liquidity & Tick Math
In Raydium CLMM, prices are represented logarithmically as discrete tick intervals. The relationship between price P and tick index i is governed by:
P(i) = 1.0001^iEach pool enforces a specific tickSpacing (e.g. 10, 60, 120). Any arbitrary price selected by a user must be snapped to the nearest multiple of tickSpacing:
export function alignTickToSpacing(tick: number, spacing: number): number {
const remainder = tick % spacing;
if (remainder === 0) return tick;
return remainder >= spacing / 2 ? tick + (spacing - remainder) : tick - remainder;
}
export function priceToTick(price: number): number {
return Math.floor(Math.log(price) / Math.log(1.0001));
}Developer Quickstart
Clone the repository and initialize the development server locally to test framing simulations against Solana devnet or mainnet-beta.
# Clone the repository
git clone https://github.com/Oxbull7000/keepx.git
cd keepx
# Install dependencies
npm install
# Run the local development server
npm run dev
# Run unit tests and type checks
npm run test
npm run typecheckSecurity Model & Risk Disclaimers
Providing concentrated liquidity involves price exposure and impermanent loss risk if market prices exit your selected range.
- Impermanent Loss: If the price of Token A falls below your lower range, your position will convert 100% into Token A.
- No Fee Earnings Out of Range: While market price is outside your framed interval, the position does not accrue trading fees.
- Non-Custodial Smart Contract Safety: All funds are deposited into verified Raydium CLMM program accounts (`CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK`).