MoonPay Payroll
CSV Schema
Required headers:
namechain_addresstoken_namechain_nameaccountfrequency
Validation Rules
- Header set must match required payroll schema.
chain_addressmust be valid EVM format for current implementation.- Unknown token/chain mapping is flagged during planning.
- Invalid rows are marked and skipped from executable routes.
Planning Model
- Parse CSV
- Validate rows
- Resolve treasury position (account/token/chain/balance)
- Generate per-row settlement route:
- direct
- swap
- bridge
- bridge+swap
Planner is reusable and available in shared MoonPay/payroll modules.
Execution Model
- Batch rows are persisted with row statuses:
pending,validated,routed,executing,completed,failed,skipped,awaiting_user_action
- Execution is idempotent per batch/row.
- Row failures do not abort unrelated rows.
- Failed rows can be retried.
Scheduling
Scheduler state is persisted in SQLite:
payroll_batchespayroll_batch_rowspayroll_schedulespayroll_run_historypayroll_accounts
Run due schedules:
pnpm payroll:run-due
Notes
- Payroll is treasury-funded and must not bypass treasury controls.
- Buy-crypto flows are user-assisted and not the primary autonomous payroll path.
- Autonomous paths prefer swap/bridge/transfer routes.