The rebalance algorithm

The engine in site/assets/core/maker.js is the algorithm the keeper runs. The keeper adds only network code around it (keeper/logic.mjs).

Inputs

Step 1: measure

pumpUsd = (vSol / vTok) * SOL_USD
ponsUsd = (q / t) * ETH_USD
spread  = pumpUsd / ponsUsd - 1

If |spread| <= band, stop.

Step 2: choose the side

rich  = spread > 0 ? pump.fun : Pons
cheap = the other one

Step 3: size the trade

The size is solved by bisection so that the spread lands back at the target.

Sixty iterations. The keeper turns the result into a transaction with a minimum output of the simulated output minus 1.5 %.

Step 4: chain up to three steps

One trade may not be enough, for example when the pool runs out of tokens on the rich chain. It then continues with a buy on the cheap chain, up to three steps in all. If the pool has nothing to use, it holds and reports vault empty.

Properties checked by tests

Trade execution

ChainBuySell
Solanapump.fun buy from the keeper wallet, with a create-ATA and an init-volume-accumulator step when neededpump.fun sell
Robinhood ChainGlintVault.buy(ethIn, minTokensOut)GlintVault.sell(tokensIn, minEthOut)

Both Solana transactions were simulated against mainnet state and the vault calls run against the live Pons in the fork tests, see test results.