Automatic PayoutPool top-ups
Decision 51 (owner-approved Nov 17, 2026) makes routine PayoutPool top-ups automatic, within a limit. Clear Lending's money moves from CL Operating into the PayoutPool only when the pool is short or about to be, and never more than a spending limit that CL Operating's owners set on chain. Before this, a person moved the money every time (decision 49), and the read-only keeper only emailed ops.
On this page
The job is apps/api/src/jobs/payoutTopUp.ts. Its rules are in apps/api/src/services/payoutFunding/topUp.ts. It is off unless PAYOUT_TOPUP_ENABLED=1. The read-only payout funding keeper (payoutFundingKeeper.ts, DEPLOY-RUNBOOK.md §4.3) keeps running beside it and does not change.
The money path
- CL Operating (
0xfAFf1081F77bF528bA21eea590f251a755bCdf65on Base Sepolia) is Clear Lending's Safe, where Yield Pool Deployments land. It is a Safe v1.5.0 with one owner, the Clear Lending Safe (2 of 2). - Safe's AllowanceModule (v0.1.1,
0xAA46724893dedD72658219405185Fb0Fc91e091C, the canonical deployment fromsafe-modules-deployments) is enabled on CL Operating. It lets one named delegate spend up to a set amount of one token per period, and nothing else. On Base Sepolia there is also a contract reporting "Allowance Module 1.0.0" at0x691f…E331. It is not in Safe's released deployments, so it is not used. - The top-up wallet is a Coinbase CDP server wallet,
payout-topup-base-sepolia(0xC0C4EC7875D1838C0AE610accC16AAdCDb475068). It is the module's delegate on CL Operating and holds the PayoutPool'sFUNDER_ROLE, and nothing else.
A top-up is three transactions from the top-up wallet, each for the same exact amount:
- 1.
AllowanceModule.executeAllowanceTransfer(CL Operating, USDC, wallet, amount, 0x0, 0, wallet, "")moves USDC from CL Operating to the wallet. The wallet sends this itself. With an empty signature the module treatsmsg.senderas the signer and checks it is a delegate of that Safe. No signed message, nonce or relayer is involved, and the module refuses anything over what is left of the limit this period. - 2.
USDC.approve(PayoutPool, amount). - 3.
PayoutPool.fund(amount). The pool pulls the USDC and records it as the wallet's capital.
The wallet never calls withdrawCapital. The code refuses that call, and every call other than these three, before anything is signed. The wallet pulls only what it is about to fund, so between top-ups it holds no USDC. It needs a little ETH for gas: it held 0.005 on Nov 17, 2026.
When it moves
It checks every 15 minutes, reading views only. It moves rarely:
dueWithin(14 days).short == 0)dueWithin(30 days).short + margin. The next move is then weeks away.Notes on the rules:
- The 14-day low-water mark sits well before addendum 12.10's deadline: each charge funded 2 business days before the merchant's payout deadline. The job will not accept a low horizon under 7 days.
- Truncated lists.
dueWithinlists at mostmaxClaimsclaims, and its total covers only those. A list that comes back full is read again with a limit four times larger, up to 3,200. If it is still full, the need is taken as everything queued (queuedTotal). That may over-fund, within the limit. It never under-funds without saying so. - Debug logging. Each check's projections are logged when
PAYOUT_TOPUP_DEBUG=1, and saved for the Command Center every time.
The limit
The spending limit lives on chain, on CL Operating, and only CL Operating's owners can change it. On Base Sepolia it is $5,000 per week: PAYOUT_TOPUP_CAP_USDC=5000 and PAYOUT_TOPUP_RESET_MINUTES=10080. Weeks count from Monday Nov 16, 2026, 00:00 UTC (PAYOUT_TOPUP_RESET_BASE_MINUTES=29913120).
At testnet volumes that is several 30-day refills. It is also the most a bug, or someone holding the wallet's key, could move out of CL Operating in a week. For mainnet, set it from the largest weekly refill expected, with some headroom. The module's period is at most 65,535 minutes (about 45 days).
What else a stolen wallet key could reach, beyond the limit:
- the wallet's own idle capital in the PayoutPool (
idleCapitalOf), throughwithdrawCapital. The code never calls it; a thief could. - the positions the wallet's capital bought (
_placePosition), redeemable throughredeem, and the carry paid on them.
Each of these is bounded by what the wallet has funded and not yet recovered. If the key is in doubt:
- 1.Revoke the wallet's
FUNDER_ROLE. This is the PayoutPool admin's call: the deployer before I2, a credit timelock proposal after. - 2.Have CL Operating remove the delegate:
AllowanceModule.removeDelegate(wallet, true).
What people sign, once
scripts/signing_plan.ts lists these steps (re-run it after each). Their inputs are in deploy/config/base-sepolia.rollout.env: PAYOUT_TOPUP_WALLET, PAYOUT_TOPUP_CAP_USDC, PAYOUT_TOPUP_RESET_MINUTES, PAYOUT_TOPUP_RESET_BASE_MINUTES and PAYOUT_TOPUP_ALLOWANCE_MODULE. While any is empty, its steps wait and nothing else does.
TU-funderPayoutPool.grantRole(FUNDER_ROLE, wallet) on the fresh PayoutPool. It waits for deploy 22. After the credit handover (I2) the PayoutPool's admin is the credit timelock, and the grant becomes a 7-day proposal from the Ops Safe.TU-safe-moduleenableModule(AllowanceModule)TU-safe-delegateAllowanceModule.addDelegate(wallet)TU-safe-allowanceAllowanceModule.setAllowance(wallet, USDC, cap, period, base)The three CL Operating calls are one batch: deployments/base-sepolia/safe-batches/signing-TU-cl-operating-setup.json. CL Operating is nested, so sign it like this:
- 1.In the Safe app, open CL Operating.
- 2.Load the batch in Transaction Builder.
- 3.Confirm it from the Clear Lending Safe. Both of its owners sign.
- 4.Execute it.
To check the setup read-only, run npx hardhat run scripts/check_rollout_inputs.ts --network base-sepolia. Each of the following passes, or shows a WARN while its step is still to do:
- the module is Safe's;
- the module is enabled on CL Operating;
- the wallet is a plain account and no other job's wallet;
- the wallet is CL Operating's delegate, with the rollout's allowance;
- on the fresh PayoutPool, the wallet holds
FUNDER_ROLEand no other role.
To change the limit later, CL Operating's owners call setAllowance again (the plan writes it), or remove the delegate to stop the job entirely.
What the alerts mean
Alerts go to OPS_ALERT_EMAIL, and each is sent once (keyed in ops_alerts).
USDC.transfer(top-up wallet, X). Sign it like the setup batch. On its next check the wallet funds exactly that, with approve and fund.FUNDER_ROLE is missing, or the wallet holds another PayoutPool role.TU- steps. Revoke any extra role.When it stops
Any revert stops the job: a dry run (eth_call and estimateGas) or a mined transaction. The job marks the top-up failed, alerts, and moves nothing more until a person clears it. The read-only keeper keeps alerting meanwhile.
- 1.Read the alert and the top-up's transactions (Command Center, or
ops.payout_topups). - 2.Check the wallet's USDC. If a pull went through but the fund did not, the USDC is in the wallet. After you clear the stop, the next check funds exactly that, without pulling again.
- 3.Once the cause is understood, clear it:
cd apps/api && bun src/scripts/clearPayoutTopUpHalt.ts <top-up id> "<your name>".
Restarts and double funding
Every top-up is recorded (migration 0078, ops.payout_topups) before its first transaction. The record holds:
- its trigger;
- both projections;
- the amount and the remainder;
- the allowance's nonce;
- each transaction hash.
At most one top-up per pool is in flight; a unique index enforces it. A check that finds one in flight finishes it rather than starting another. After a restart, the job reads the chain to see how far it got:
- the receipts it recorded;
- the allowance nonce: if it is past the recorded one, the pull happened;
- the wallet's balance and approval: if both are spent, the fund happened.
Each send carries a CDP idempotency key made from the top-up and the step, so a send repeated after a crash is the same transaction. One trigger is never funded twice.
Not automated yet
The positions the wallet's capital buys, and the carry paid on them, accrue to the top-up wallet: fund records the capital as the wallet's own. Nothing yet redeems them, or moves the proceeds back to CL Operating. Until something does, they stay with the wallet, recorded on chain. It is an open item for a later change.
Railway variables (the API)
PAYOUT_TOPUP_ENABLED1 turns the job on.PAYOUT_TOPUP_WALLETPAYOUT_TOPUP_CDP_ACCOUNT_NAMEpayout-topup-base-sepolia on 84532CDP_API_KEY_ID, CDP_API_KEY_SECRET, CDP_WALLET_SECRET, or the SAVINGS_/SEND_ ones).PAYOUT_TOPUP_SAFEPAYOUT_TOPUP_ALLOWANCE_MODULE0xAA46…091CNAME() == "Allowance Module", or the job does not start.PAYOUT_TOPUP_CHECK_MINUTESPAYOUT_TOPUP_LOW_DAYSPAYOUT_TOPUP_TARGET_DAYSPAYOUT_TOPUP_MARGIN_USDCPAYOUT_TOPUP_MAX_CLAIMSPAYOUT_TOPUP_CAP_USDCPAYOUT_TOPUP_DEBUG1 logs each check's projections.OPS_ALERT_EMAIL, DATABASE_URLThe PayoutPool is PAYOUT_POOL_<chainId>, or the default in apps/api/src/config/contracts.ts. USDC is the PayoutPool's reserveToken(). Point PAYOUT_POOL_84532 at the fresh PayoutPool after deploy 22 (DEPLOY-RUNBOOK.md §4.2) before turning the job on.