# arl:plan-seed — Ammora SDK 0.3.8 Check the source for arguments and transaction requirements. [Read in Docs](https://docs.ammora.org/examples?command=arl%3Aplan-seed) · [Detailed guide](https://docs.ammora.org/guides/src-arl-readme) · [Local setup](https://docs.ammora.org/guides/example-setup) ## Context and execution GIWA Sepolia 91342. Public SDK 0.3.8, Math 0.3.0. Source revision: `a9b3fd798fa51495e8defec99a25de59e4d70672`. Install the SDK in your app, or prepare the example project using the local setup guide for its npm commands. Review the entry source and guide for required arguments, roles and deployment selection. `AMMORA_SEND=0` does not turn send-only commands into previews. Never put CLI keys in a browser or resend an uncertain transaction. Command: `npm run arl:plan-seed -- ` (`tsx src/arl/plan-band-pool-seed.ts`). Omit `--` and arguments when the source accepts none. ## Entry file: `src/arl/plan-band-pool-seed.ts` ```typescript import { tokenAmount } from "../shared/input.js"; /** * Work out the price and liquidity that seed a band pool from two fixed budgets. * Reads only. No key required, and nothing is created. * * npm run arl:plan-seed -- * * Seeding a range pool by guessing a price leaves one side's remainder behind. Solving * for the price instead consumes both budgets down to rounding dust. */ import { planConcentratedSeed, sqrtPriceX64FromHumanPrice } from "@ammora-protocol/sdk"; import { main } from "../shared/run.js"; const parseDecimals = (label: string, value: string | undefined): number => { const decimals = Number(value ?? 18); if (!Number.isInteger(decimals) || decimals < 0 || decimals > 36) { throw new RangeError(`${label} must be a whole number of decimals between 0 and 36`); } return decimals; }; main(async () => { const [ baseArgument, quoteArgument, minArgument, maxArgument, baseDecimalsArgument, quoteDecimalsArgument, ] = process.argv.slice(2); if (!baseArgument || !quoteArgument || !minArgument || !maxArgument) { throw new Error( "usage: npm run arl:plan-seed --" + " [baseDecimals] [quoteDecimals]", ); } // Both default to 18, which is the common case, but a pair that disagrees has // to say so: prices are a ratio of raw units, and planning an 18/6 pair as // though it were 18/18 puts the price out by a factor of a trillion. That is // not a rounding error — it opens the pool far enough from the intended price // that the first swap takes one side of it entirely. const baseDecimals = parseDecimals("baseDecimals", baseDecimalsArgument); const quoteDecimals = parseDecimals("quoteDecimals", quoteDecimalsArgument); const baseAmount = tokenAmount(baseArgument, baseDecimals); const quoteAmount = tokenAmount(quoteArgument, quoteDecimals); const sqrtPriceFromDecimal = (price: string): bigint => sqrtPriceX64FromHumanPrice(tokenAmount(price, 18), 18, baseDecimals, quoteDecimals); const sqrtMinPriceX64 = sqrtPriceFromDecimal(minArgument); const sqrtMaxPriceX64 = sqrtPriceFromDecimal(maxArgument); const plan = planConcentratedSeed(baseAmount, quoteAmount, sqrtMinPriceX64, sqrtMaxPriceX64); const leftoverBase = baseAmount - plan.baseUsed; const leftoverQuote = quoteAmount - plan.quoteUsed; const share = (left: bigint, total: bigint) => total === 0n ? "0" : `${(Number(left * 1_000_000n / total) / 10_000).toFixed(4)}%`; console.log(`range ${minArgument} .. ${maxArgument} quote per base`); console.log(`budget base ${baseArgument}, quote ${quoteArgument}`); console.log(`decimals base ${baseDecimals}, quote ${quoteDecimals}`); console.log(""); console.log(`sqrtPriceX64 ${plan.sqrtPriceX64}`); console.log(`liquidity ${plan.liquidity}`); console.log(`base used ${plan.baseUsed} (left ${leftoverBase}, ${share(leftoverBase, baseAmount)})`); console.log(`quote used ${plan.quoteUsed} (left ${leftoverQuote}, ${share(leftoverQuote, quoteAmount)})`); console.log(""); console.log("Feed sqrtPriceX64 and liquidity to the factory's creation parameters."); console.log("createProductionPoolLocked seals the first position in the same call, so"); console.log("there is no moment where the creator holds it unlocked."); }); ``` ## Supporting files Keep relative paths intact. Local imports are listed recursively; JSON templates are choices to review, not approved inputs. Runtime-selected files and wallet/environment setup still follow the detailed guide. - [src/shared/env.ts](https://docs.ammora.org/examples/source/src/shared/env.ts.txt) - [src/shared/input.ts](https://docs.ammora.org/examples/source/src/shared/input.ts.txt) - [src/shared/retry.ts](https://docs.ammora.org/examples/source/src/shared/retry.ts.txt) - [src/shared/rpc.ts](https://docs.ammora.org/examples/source/src/shared/rpc.ts.txt) - [src/shared/run.ts](https://docs.ammora.org/examples/source/src/shared/run.ts.txt) - [package.json](https://docs.ammora.org/examples/source/package.json.txt) - [package-lock.json](https://docs.ammora.org/examples/source/package-lock.json.txt) - [tsconfig.json](https://docs.ammora.org/examples/source/tsconfig.json.txt) - [.env.giwa.example](https://docs.ammora.org/examples/source/file.env.giwa.example.txt) - [.nvmrc](https://docs.ammora.org/examples/source/file.nvmrc.txt) ## AI implementation checklist Use the actual SDK exports and parameter types in the linked files. Start with reads and unsigned plans where supported. Use a connected wallet for browser signing. Preserve raw integer units, exact approvals, caller authority, deadlines and receipt reconciliation. Report local checks separately from live-chain verification.