Skip to content

winsznx/remlo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

230 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remlo

Borderless enterprise payroll on Tempo L1. AI agents execute compliant batch payments via MPP, employees receive in 0.4s, and spend via Visa.

What it does

Remlo turns payroll into Tempo-native settlement flows built on TIP-20 transfers with fixed 32-byte ISO 20022 memos that encode paic, employer ID, employee ID, pay period, cost center, and record hash. Every payout path runs through the TIP-403 Policy Registry before funds move, and atomic payroll runs execute through PayrollBatcher.executeBatchPayroll so a batch settles as one unit. Streaming compensation is handled by StreamVesting on a per-second accrual model, while Bridge provides employer virtual accounts, employee off-ramp rails, and Visa card issuance. All programmatic payroll operations are exposed as MPP endpoints and gated by HTTP 402 charges, so agents pay in PathUSD per action instead of authenticating with long-lived API keys.

Architecture

Remlo is a Tempo settlement layer wrapped in a Next.js control plane. On-chain contracts handle treasury accounting, atomic payroll batches, employee compliance anchoring, salary streaming, and yield routing; Supabase stores employer, employee, payroll, compliance, and MPP session state; Bridge supplies the fiat ingress and card/off-ramp surface; Privy abstracts wallet creation and gas sponsorship; and mppx monetizes machine access to every payroll workflow.

Layer Technology
Chain Tempo L1 (Chain ID 42431, Simplex BFT, 0.5s finality)
Token standard TIP-20 (6-decimal, ISO 20022 memo fields)
Compliance TIP-403 Policy Registry (OFAC sanctions screening on every transfer)
Machine payments MPP / mppx (HTTP 402, PathUSD, sessions + SSE streaming)
Fiat rails Stripe Bridge API (virtual accounts, Visa cards, ACH/SEPA/PIX off-ramp)
Wallets Privy embedded wallets (email/SMS, gasless via TempoTransaction Type 0x76)
Agent signing Vincent / Lit Protocol PKPs (non-custodial threshold signing, programmable spend policies)
Frontend Next.js 15 App Router, TypeScript, Tailwind, shadcn/ui
Database Supabase (PostgreSQL, RLS, realtime)
State Zustand + TanStack Query

MPP Endpoints

Route Charge Description
/api/mpp/treasury/yield-rates $0.01 Reads YieldRouter.getYieldSources() and YieldRouter.getCurrentAPY() for an AI treasury agent.
/api/mpp/payroll/execute $1.00 Executes PayrollBatcher.executeBatchPayroll() and persists payroll receipt metadata to Supabase.
/api/mpp/employee/advance $0.50 Claims accrued streamed wages from StreamVesting.claimAccrued() for an employee.
/api/mpp/compliance/check $0.05 Runs TIP-403 authorization checks and records the result in compliance_events.
/api/mpp/employee/balance/stream $0.001/tick Streams live accrued salary balance over SSE using session vouchers and StreamVesting.getAccruedBalance().
/api/mpp/payslips/[runId]/[employeeId] $0.02 Returns a single payslip assembled from payment_items and payroll_runs.
/api/mpp/memo/decode $0.01 Decodes on-chain TIP-20 memo bytes into ISO 20022 payroll fields via Viem.
/api/mpp/employee/[id]/history $0.05 Returns employee payment history from payment_items and payroll_runs.
/api/mpp/bridge/offramp $0.25 Initiates a Bridge transfer from payroll balance to local bank rails.
/api/mpp/treasury/optimize $0.10 Session endpoint for treasury and yield optimization using YieldRouter and PayrollTreasury.
/api/mpp/marketplace/compliance-list/[employerId] $0.50 Returns the employer compliance event ledger for auditors and marketplace consumers.
/api/mpp/agent/session/treasury $0.02 Session endpoint for agent balance, yield, rebalance, and headcount actions across Remlo contracts.

Smart Contracts

Contract Description Moderato testnet address
PayrollTreasury Employer treasury ledger for payroll balances, locked funds, and gas budget sponsorship. 0xeFac4A0cC3D54903746e811f6cd45DD7F43A43a5
PayrollBatcher Atomic batch executor that sends TIP-20 payroll transfers with memo fields in one run. 0x90657d3F18abaB8B1b105779601644dF7ce4ee65
EmployeeRegistry Employee wallet registry anchored to employer identity and TIP-403 policy approval. 0xe7DdA49d250e014769F5d2C840146626Bf153BC4
StreamVesting Per-second salary streaming contract with accrued balance reads and claims. 0x83ac4D8E7957F9DCD2e18F22EbD8b83c2BDD3021
YieldRouter Yield allocation layer for idle treasury capital and employer/employee yield splits. 0x78B0548c7bb5B51135BBC87382f131d85abf1061

Local development

pnpm install
cp .env.local.example .env.local
# fill in env vars - see Environment Variables section below
pnpm dev

Contract deployment

foundryup -n tempo
cd contracts
forge build
cast rpc tempo_fundAddress <YOUR_ADDRESS> --rpc-url https://rpc.moderato.tempo.xyz
forge script script/Deploy.s.sol --broadcast --rpc-url https://rpc.moderato.tempo.xyz

Running the demo agent

npx ts-node scripts/demo-agent.ts

The script opens an MPP session, demonstrates non-custodial transaction signing via a Vincent PKP wallet (step 1b), queries yield, checks compliance, executes payroll, starts the streaming balance flow, and closes the session. The full run spends roughly $1.33 across 12 MPP actions, with unspent session balance returned on close.

Set VINCENT_DELEGATEE_PRIVATE_KEY, VINCENT_PKP_ETH_ADDRESS, and VINCENT_AGENT_ADDRESS to activate live PKP signing in step 1b. Without them the step runs in stub mode and prints the signing flow without hitting the Lit network.

To provision the three Vincent env vars, run the registration script:

DELEGATEE_PRIVATE_KEY=0x... npx ts-node scripts/setup-vincent.ts

See VINCENT_SETUP.md for the full setup flow including PKP minting and contract whitelist policy configuration.

Environment variables

Variable Description
NEXT_PUBLIC_TEMPO_RPC Tempo Moderato RPC URL used by client and server contract callers.
NEXT_PUBLIC_TEMPO_CHAIN_ID Public chain ID for Tempo Moderato.
NEXT_PUBLIC_PRIVY_APP_ID Privy application ID from the Privy dashboard.
NEXT_PUBLIC_SUPABASE_URL Public Supabase project URL.
NEXT_PUBLIC_SUPABASE_ANON_KEY Public Supabase anon key used by browser clients.
NEXT_PUBLIC_PAYROLL_TREASURY Deployed PayrollTreasury address exposed to the frontend.
NEXT_PUBLIC_PAYROLL_BATCHER Deployed PayrollBatcher address exposed to the frontend.
NEXT_PUBLIC_EMPLOYEE_REGISTRY Deployed EmployeeRegistry address exposed to the frontend.
NEXT_PUBLIC_STREAM_VESTING Deployed StreamVesting address exposed to the frontend.
NEXT_PUBLIC_YIELD_ROUTER Deployed YieldRouter address exposed to the frontend.
NEXT_PUBLIC_APP_URL Public app origin used for MPP session callback URLs.
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID Optional public WalletConnect project id used by Privy when external wallet connections are enabled.
SUPABASE_SERVICE_KEY Server only. Supabase service role key for API routes and background writes.
BRIDGE_API_KEY Server only. Stripe Bridge API key for fiat rails, card issuance, and off-ramp operations.
BRIDGE_WEBHOOK_SECRET Server only. Bridge RSA webhook verification secret.
TEMPO_WEBHOOK_SECRET Server only. Tempo webhook verification secret for /api/webhooks/tempo.
REMLO_TREASURY_ADDRESS Server only. Tempo wallet that receives MPP fees.
REMLO_AGENT_PRIVATE_KEY Server only. Private key for the autonomous demo treasury agent.
RESEND_API_KEY Server only. Resend API key for invite and notification email delivery.
CLAUDE_API_KEY Server only. Anthropic API key for CSV parsing, anomaly detection, and compliance explanations.
STRIPE_SECRET_KEY Server only. Stripe secret key used by multi-rail MPP payment fallback.
MPP_SECRET_KEY Server only. Base64 secret used by mppx to sign and verify session state.
ADMIN_USER_IDS Optional server-only comma-separated allowlist for /admin.
DEMO_MPP_CREDENTIAL Optional local demo credential for scripts/demo-agent.ts.
DEMO_EMPLOYER_ID Optional local override for the demo employer id.
DEMO_PAYROLL_RUN_ID Optional local override for the demo payroll run id.
DEPLOYER_PRIVATE_KEY Local contract deployment key used by contracts/script/Deploy.s.sol.
LIT_API_KEY Server only. Lit Chipotle admin key — manages groups, PKPs, and action authorization.
LIT_USAGE_KEY Server only. Lit Chipotle execute-scoped key used by signWithVincent() at runtime.
VINCENT_PKP_ETH_ADDRESS Server only. PKP agent wallet address on Tempo L1 — the non-custodial signing identity.

Existing workspaces must also have employers.employer_admin_wallet backfilled with the actual Tempo/Privy wallet that funds PayrollTreasury. Treasury, payroll, and yield reads now derive the on-chain employer account id from that wallet rather than hashing the off-chain employer UUID.

About

Remlo — borderless enterprise payroll on Tempo L1. AI agents trigger compliant batch payments via HTTP 402 (MPP), employees receive funds in 0.4s and spend via Visa card. Built with TIP-20 memo fields, TIP-403 sanctions screening, Stripe Bridge fiat rails, and per-second salary streaming.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors