Idle stablecoin cash sweeps
What it is
Idle stablecoin cash sweeps move stablecoins that build up in an operating wallet beyond what the business needs into a tokenized money market or liquidity fund, the onchain version of a bank’s automated cash sweep.
Treasury teams run them so receipts earn a return instead of sitting idle, and every sweep is a payment that needs approval and a record.
Tokenized funds built to take these sweeps accept subscriptions and redemptions in stablecoins, but the rule for when to sweep is one each treasury team writes for itself.
Goldsky spots a balance over your threshold and runs the task that sends the sweep for your custodian to sign, while the threshold, the approval policy and the choice of fund stay with you.
You can sweep idle stablecoin cash two ways: have a Turbo Pipelines webhook start a Compose task when a balance passes your threshold, or run a scheduled Compose task that checks balances through the Feeds API.
Who it’s for
Stablecoin payment companies, custodian banks and asset managers that hold operating cash onchain.
How idle stablecoin cash sweeps work
The diagram follows one sweep from receipts building up in an operating wallet to fund shares issued for the cash, and shows who does each step. Your setup may differ.
Ways to sweep idle stablecoin cash
A balance pipeline starts the sweep as soon as a balance crosses the threshold; the scheduled task checks at the times you set, so cash can sit over the threshold until the next run.
- Best for
- Sweeps that start as soon as a balance passes the threshold
- What you run
- The destination: your database, queue or bucket, or a Postgres database Goldsky hosts
- What you write
- Pipeline YAML and SQL; TypeScript transforms when needed
- Where your data lives
- In your own database or systems
- How results reach you
- Pushed to you
- Best for
- Tens of wallets, swept on a schedule from one codebase
- What you run
- Nothing on Goldsky cloud; single-tenant, VPC and on-premises deployments are enterprise options
- What you write
- TypeScript tasks
- Where your data lives
- Hosted by Goldsky
- How results reach you
- Acts onchain or calls your systems
| Usual setupOption 1: Pipeline and task | Option 2: Scheduled task | |
|---|---|---|
| Best for | Sweeps that start as soon as a balance passes the threshold | Tens of wallets, swept on a schedule from one codebase |
| Products | TurboCompose | ComposeFeeds |
| What you run | The destination: your database, queue or bucket, or a Postgres database Goldsky hosts | Nothing on Goldsky cloud; single-tenant, VPC and on-premises deployments are enterprise options |
| What you write | Pipeline YAML and SQL; TypeScript transforms when needed | TypeScript tasks |
| Where your data lives | In your own database or systems | Hosted by Goldsky |
| How results reach you | Pushed to you | Acts onchain or calls your systems |
Collect receipts in an operating wallet
Customer payments and other receipts arrive in the wallet the business uses day to day.
Each receipt raises the balance. Until enough blocks sit on top of a receipt, a reorg (the chain replacing its newest blocks) can still undo it.
Spot cash over your threshold
Handled by Goldsky TurboCash above what operations needs is idle, and a sweep can only start once you know it’s there.
Each time the wallet receives, its balance is read at that block and compared with your threshold. A rule about one balance works here; a rule about how long cash has sat idle needs a schedule.
A Turbo Pipelines transform reads the balance with
Set up a webhook sink (opens in a new tab)_gs_eth_callat each transfer’s block and keeps only rows above your threshold, which a webhook sink then posts.Start the sweep
Handled by Goldsky ComposeA balance over the threshold is only a trigger; the sweep itself is code that decides how much to move.
The task works out the amount from your rules, such as everything above a working balance, and checks it hasn’t already swept this cash. Without that check, a repeated webhook moves the cash twice.
Compose starts your task from the webhook through an HTTP trigger, and the task can read the wallet’s balance again before it acts.
Set up an HTTP trigger (opens in a new tab)Approve and sign the sweep
Moving money takes a signature, and most teams keep their keys with a custodian whose policy says who can approve what.
The sweep is signed under limits and approvers set before it runs. A sweep that skips the policy lets anyone who can change the code move the cash.
Send the sweep
Handled by Goldsky ComposeThe sweep is done when the transfer to the fund’s subscription address is confirmed on the chain.
The transfer can be dropped, or undone by a reorg, so it’s watched until final and resent if needed, without ever sending twice.
Goldsky Compose sends the transfer through a webhook wallet, which has your signing endpoint sign it as a UserOperation (the transaction format smart-account wallets use), plus a one-time EIP-7702 authorization the first time it sends on a chain, then waits for the confirmations you set and logs each step of the run.
Learn about webhook wallets (opens in a new tab)Receive the fund shares
The cash buys shares in the fund, which are issued to you once the fund settles the order.
The fund’s tokenization platform mints the shares to your wallet. Until they arrive, the cash has left with nothing yet in its place, so treasury tracks the order as pending.
What to know about sweeping from a balance pipeline
- Goldsky runs the pipeline and the task; your custodian signs, and the fund issues the shares.
- The webhook fires when the balance is first seen over the threshold, before it’s final, so the task checks the balance again before sending.
- A webhook can arrive more than once, so the task has to recognize a sweep it has already sent.
- Rules about time, such as sweeping only at day end, belong in a scheduled task instead.
Collect receipts in an operating wallet
Customer payments and other receipts arrive in the wallet the business uses day to day.
Each receipt raises the balance. Until enough blocks sit on top of a receipt, a reorg (the chain replacing its newest blocks) can still undo it.
Check balances on a schedule
Handled by Goldsky ComposeSomeone has to look at the wallet regularly to notice cash building up.
The check runs at times you set, such as hourly or at day end. Checks set far apart leave cash idle for longer.
A Compose task with a cron trigger runs at the times you set and calls the Feeds balances endpoint for each operating wallet with
Schedule a task with a cron trigger (opens in a new tab)fetch.Decide whether to sweep
Handled by Goldsky ComposeNot every balance is idle, because the business needs a working float.
The task compares each balance with your threshold and works out how much to move. It has to know whether a sweep is already in flight, or it sends a second one for the same cash.
The rule runs inside the Goldsky Compose task, and the run log records the balances it read and the decision it made.
See the logs of each run (opens in a new tab)Approve and sign the sweep
Moving money takes a signature, and most teams keep their keys with a custodian whose policy says who can approve what.
The sweep is signed under limits and approvers set before it runs. A sweep that skips the policy lets anyone who can change the code move the cash.
Send the sweep
Handled by Goldsky ComposeThe sweep is done when the transfer to the fund’s subscription address is confirmed on the chain.
The transfer can be dropped, or undone by a reorg, so it’s watched until final and resent if needed, without ever sending twice.
Compose sends the transfer through a webhook wallet, which has your signing endpoint sign it as a UserOperation (the transaction format smart-account wallets use), plus a one-time EIP-7702 authorization on a chain it hasn’t sent on before. It waits for the confirmations you set and resends the transfer if a reorg drops it.
Handle confirmations and reorgs (opens in a new tab)Receive the fund shares
The cash buys shares in the fund, which are issued to you once the fund settles the order.
The fund’s tokenization platform mints the shares to your wallet. Until they arrive, the cash has left with nothing yet in its place, so treasury tracks the order as pending.
What to know about sweeping idle cash on a schedule
- The task checks on your schedule, so cash can sit over the threshold until the next run.
- Rules about time, such as sweeping once at day end, fit well, because the schedule decides when the check runs.
- Balances come from the API, so wallets on chains it doesn’t cover need another way.
- Every request and transaction the task makes is logged on its run.
What you control
- Your providers
- Custodian
- Transfer agent
Security and deployment
- SOC 2 Type IIIndependently audited security controls.
- Dedicated infrastructureSingle-tenant options for production workloads.
- Data residencyCloud, on-premises or co-located.
More use cases that manage treasury
- Stablecoin treasury management across chainsSee stablecoin cash across every wallet and chain in one place.
- Gas wallet monitoringKeep gas wallets funded on every chain and alert before one runs dry.
- Sponsored gas spendTotal the gas you pay for your users per user, paymaster and day, watch the paymaster’s deposit and check the provider’s bill.
- Intercompany settlement in stablecoinsSettle what group entities owe each other in stablecoins, and land each transfer beside the intercompany ledger.
Use cases built the same way
- Authorize and capture stablecoin paymentsHold a buyer’s stablecoins in an escrow contract at checkout, capture them to the merchant as orders ship, void what can’t be filled and refund after capture.
- Stablecoin payouts for marketplaces and creatorsPay sellers, gig workers and creators in stablecoins from a marketplace balance.
- Stablecoin payroll and contractor payoutsPay contractors and staff in stablecoins and confirm each payout settled.
- Stablecoin merchant settlementPay each merchant’s settlement in stablecoins to the wallet and network it chose, on any day, and record the transaction against the settlement.
Sweep idle stablecoin cash with Goldsky
We’ll map it to your systems and show you what Goldsky runs, so your team builds the product, not the pipelines underneath it.