Skip to content

Add pool-level enabled flag to pause trading#86

Merged
TaprootFreak merged 2 commits into
developfrom
feat/pool-enabled-flag
May 15, 2026
Merged

Add pool-level enabled flag to pause trading#86
TaprootFreak merged 2 commits into
developfrom
feat/pool-enabled-flag

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

  • New enabled flag at pool config root (default true); when set to false, the bot keeps polling prices, updating the dashboard, persisting history and tracking the portfolio, but skips every on-chain write (token wrapping, NFT/SwapRouter approvals, depeg-driven emergency withdraw, initial band mint, band rebalances).
  • pools.dev.yaml sets enabled: false for svjusd-wcbtc-citrea so the DEV bot stops the INSUFFICIENT_FUNDS error loop after the wallet ran out of gas.
  • PRD config is untouched (default enabled: true).

Motivation

The DEV wallet for the svjusd-wcbtc-citrea pool ran out of cBTC for gas and produced ~16 Rebalance errors + 48 retry warnings + Telegram alert failures per hour. We want the container to keep running (Grafana dashboard, price history, portfolio tracking) but stop hammering on-chain calls until the wallet is refilled or the DEV deployment is repurposed.

Test plan

  • npm run lint clean
  • npm run build clean
  • npm test — all 114 tests pass
  • After deploy to dfxdev: docker compose logs rangekeeper shows "Trading disabled" warnings, no more Rebalance error / INSUFFICIENT_FUNDS lines
  • https://rangekeeper-dev dashboard still updates with current price and portfolio

When enabled is false (default true), the bot keeps polling prices,
updating the health dashboard, recording history and tracking the
portfolio, but skips:

- token wrapping at startup (cBTC→WCBTC, JUSD→svJUSD)
- NFT manager and swap router token approvals
- depeg detection, initial band minting and band rebalances

Set enabled: false for svjusd-wcbtc-citrea in pools.dev.yaml so the
DEV bot stops attempting transactions on a wallet that ran out of gas.
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 21:06
The RESET_BANDS env-triggered emergency withdraw was the last
remaining code path that could send transactions when a pool is
configured with enabled: false. Gate it so a disabled pool stays
inactive regardless of env vars.
@TaprootFreak TaprootFreak merged commit f2cecb4 into develop May 15, 2026
TaprootFreak added a commit that referenced this pull request May 16, 2026
The PRD config was missing the `enabled` flag (introduced in #86),
defaulting to true. The bot has been failing to initialize on every
restart because the configured wallet
0x8325b27d4Ca7d8a8bF2864b2BC7cc697BfA4A67F has zero cBTC on Citrea
Mainnet, causing `eth_estimateGas` to revert with
`gas required exceeds allowance (0)` during ERC20 approvals.

Set `enabled: false` to match the DEV config and stop the
restart-loop until the wallet is funded.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant