Lull

Mechanism

Units

The units Lull uses for amounts and prices, and how the xStock Scaled UI multiplier enters exactly once.

On chain, every amount is an integer in raw token units. Your wallet and the app show UI amounts. Scaling and rounding happen in the conversion between the two, so Lull names the unit of every amount.

The units#

UnitMeaningUsed for
Raw baseAAPLx amount before the Scaled UI multiplier, 8 decimalssell sizes, LP max base, balances, fills
Raw quoteUSDC base units, 6 decimalsbuy sizes, LP max quote, balances, fills
Quote per shareraw USDC per one share, which is one AAPLx as your wallet shows itlimit prices
pxraw quote per raw base, × 10¹²every conversion inside the cross
Multipliershares per unscaled token, × 10¹²read from the mint when Popen is captured

Scaled UI Amount#

AAPLx is a Token-2022 token with the Scaled UI Amount extension. The mint stores a multiplier, and a wallet shows a balance as:

shares = raw base × multiplier / 10^8

AAPLx shares and raw base units, 8 decimals

Loading the Scaled UI multiplier…

USDC and raw quote units, 6 decimals

USDC

raw quote = USDC × 10^6. Digits past the sixth decimal are dropped.

Example inputs, converted with the SDK's unit helpers. AAPLx uses the live Scaled UI multiplier of its mint, as the app does. Edit either side of a pair.

Lull never assumes the multiplier is 1. It differs from 1 and changes over time, for example when dividends are reinvested. The mint can schedule a new multiplier with an effective time. Lull applies the new value once that time has passed, which is the same rule Token-2022 uses for display.

From Popen to px#

Pyth publishes a price in USD per share as an integer price with an exponent expo. The cross needs raw USDC per raw AAPLx. With M = multiplier × 10¹²:

px = price × M × 10^(expo + 6 − 8)

The 6 and the 8 are the decimals of USDC and AAPLx. px already contains the multiplier, so no later step applies it again.

Example, with hypothetical numbers: Pyth reports price = 25000000 with expo = −5, which is $250.00 per share. The multiplier is 1.02, so M = 1,020,000,000,000.

px = 25,000,000 × 1,020,000,000,000 × 10^−7 = 2,550,000,000,000

One unscaled AAPLx is 100,000,000 raw base. At that px it is worth 100,000,000 × 2,550,000,000,000 / 10¹² = 255,000,000 raw quote, which is 255 USDC. That matches 1.02 shares at $250.00.

A limit of $250.00 per share is stored as 250,000,000 quote per share. Limits are per share, so the multiplier never touches them.

One source for the ratio#

Pyth also publishes a redemption-rate feed, Crypto.AAPLX/AAPL.RR. It describes the same quantity as the mint's multiplier: how many shares one unscaled token represents. Multiplying by both would count the ratio twice. The mint is the authority, because it defines what every wallet displays, while the feed reports the ratio and can lag behind a change. Lull reads the multiplier from the mint only and never multiplies by the .RR feed.

What this means for your orders#

  • Buys are sized in raw USDC. The shares you receive are computed with the multiplier in effect at capture.
  • Sells are sealed in raw base. The app converts the shares you enter with the current multiplier. If the multiplier changes between sealing and the cross, the order still sells the same raw amount, which is then a slightly different number of shares.
  • Balances are stored in raw units. The app shows them in shares with the current multiplier.
  • Rounding happens only in raw units and always favors the vault. See The cross.

Connect a wallet

No Solana wallet was found in this browser. Install one, then reload this page.

Lull asks the wallet to sign each transaction. Hardware wallets that connect over USB are not offered.