feat: add crypto-payroll blueprint - #5
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Caution Review the following alerts detected in dependencies. According to your organization's Security Policy, you must resolve all "Block" alerts before proceeding. Learn more about Socket for GitHub.
|
7ec5837 to
2d90016
Compare
|
Hey @jonas-dfns 👋 I noticed The
Happy to make any changes to better fit the repo's conventions. Would love your feedback! |
Summary
This PR adds
crypto-payroll— a new solution blueprint that demonstrates policy-gated bulk USDC payroll using Dfns wallets and the Dfns Policy Engine.It fills a documented but unimplemented gap:
docs.dfns.co/solutions/automate-paymentsdescribes this use case but no runnable code existed in the repo.What it does
A finance team runs a payroll CSV through a Dfns-secured treasury wallet. Every transfer is intercepted by a
Wallets:Signpolicy before it hits the chain:AUTO_APPROVE_LIMIT_USDC, default1000 USDC) are auto-approved by a Dfns Service Account acting as a programmatic checkerPendingand require a human approver to accept or reject them — a classic maker/checker workflowDfns features showcased
wallets.transferAssetkind: 'Erc20'Wallets:SignpolicyAlwaysTriggerrulewalletTagsfilterpayroll— does not interfere with other walletsRequestApprovalactionserviceAccountsCanApprovepolicies.listApprovalspolicies.createApprovalDecisionApprovedorDeniedwith a reason stringexternalIdon transfersWhy this is different from
programmable-policyThe existing
programmable-policyblueprint interceptsbroadcastTransactioncalls and decodes ABI-encoded smart contract call data. This blueprint operates at the transfer level (wallets.transferAsset) and enforces business rules based on amount and token contract — a different policy layer targeting a different real-world workflow.Files added
How to run
Runs on Ethereum Sepolia with testnet USDC from the Circle faucet. No paid external services required.
Test plan
npm run policy:createcreates an activeWallets:Signpolicy in Dfnsnpm run payroll:runinitiates one transfer per CSV row, each landing inPendingnpm run approvals:autoapproves rows at or belowAUTO_APPROVE_LIMIT_USDCand leaves larger ones untouchednpm run approvals:approve <id>moves a large transfer fromPendingtoApprovedand it broadcastsnpm run approvals:reject <id>denies a transfer and it does not broadcastexternalId)npm run statusshowsConfirmedfor approved and broadcast transfers🤖 Generated with Claude Code