Skip to content

Operator token rebalance: scheduled job to swap payment tokens back to SOL #646

Description

@dev-jodee

What would you like?

Goal: keep a paymaster's SOL runway stable without manual intervention.

A Kora node earns SPL tokens (payments) and spends SOL (transaction fees). Nothing converts them back today, so the operator's ability to keep paying fees drifts with the token price, and topping up SOL is a manual chore. The node should do this itself.

Shape we have in mind: a job that runs every X interval, checks the operator's token balances against configured criteria, and swaps back to SOL (Jupiter being the obvious route) when they're met.

Not already covered by what's in the repo:

  • crates/lib/src/oracle/jupiter.rs uses Jupiter for price quotes during fee estimation only, never swap execution.
  • crates/lib/src/plugin/plugin_gas_swap.rs is the inverse, user-driven flow: it validates a user's two-instruction "SPL in, SOL out" request. It never touches the operator's own balances.

Open questions

Proposals welcome on any of these:

  1. Where the job lives. Inside the node process, or a separate binary/container an operator schedules? What happens on restart, and how are overlapping runs prevented?
  2. Criteria. What should trigger a swap: absolute token balance, token value in SOL, SOL balance falling below a floor, or a target ratio? What cooldown between swaps?
  3. Which balances. Fee payer ATAs, the configured payment_address ATAs, or both? With a signer pool, per-signer or aggregate?
  4. Safety limits. A paymaster swapping its own funds on a schedule needs hard bounds: max slippage, max notional per run, route/program allowlist, and a dry-run mode. What belongs in v1?
  5. Signing and observability. Which signer signs the swap, and how do these swaps surface in logs, metrics, and usage accounting so an operator can tell a rebalance from user traffic?

Worth flagging for whoever picks this up: this would be the first feature where Kora originates and sends its own transaction rather than co-signing a user's. The fee-payer policy and Lighthouse protections are built around the co-signing model and won't cover it, so the guardrails in question 4 aren't optional extras.

Proposed by @amilz.

Area

Other

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions