Paraape
Run it

Demo swap

Trade the demo pool so the oracle has a price path.

apps/demo-swap swaps the demo meme/USDG pool through V4SwapRouter. That address is the swapRouter log from DeployParaape. V4_ROUTER_ADDRESS is the liquidity router. This script does not use it.

pnpm --filter @paraape/demo-swap start

Fill .env with the RPC, a key, USDG_ADDRESS, DEMO_MEME_ADDRESS, POOL_MANAGER_ADDRESS, and V4_SWAP_ROUTER_ADDRESS.

What a swap size means

SIM_USDG_PER_SWAP is a 6-decimal USDG notional. 100000000 is 100 USDG.

A buy spends that USDG. A sell spends the meme amount worth the same USDG at the current pool price. SIM_CONTINUOUS=1 keeps both legs going until the process stops. Set DEMO_MEME_ADDRESS_2 and PRIVATE_KEY_2 to trade a second pool with a second wallet.

Two jobs

Volatility. Many small buys, with the keeper recording, so consecutive samples see different ticks. SIM_BUY_ONLY=1 keeps the sell off so the USD price on Protect does not get walked down. Protect shows balance times the 5-minute average.

A drop that can settle. Sell a large meme amount from the deployer after activeFrom. The buyer must not be the seller. Raise SIM_USDG_PER_SWAP under SIM_SELL_ONLY=1 until the sell is large next to the pool, and mint those tokens to the deployer first. DemoToken.mint is public on the testnet tokens.

Leave SIM_RECORD_AFTER_SWAP at 0 while the keeper is running. Set it to 1 only when the keeper is off. The observer rejects a second sample inside 30 seconds.

Use a different key from the keeper.

On this page