Feat/netter#269
Conversation
There was a problem hiding this comment.
Theoretically, I think we have netting cases which are not covered with this with e.g. 3-processors having 3 different tokens which don't match bilaterally.
But for initial implementation I would go with this and if cases like above show up often we can always push it as optimization
There was a problem hiding this comment.
Pull request overview
Adds “processor netting” support by introducing a Netter contract that can atomically settle (net) two processors’ opposing foreign-asset balances using an oracle value check, plus a new forwardAmount API on Processor to forward partial balances.
Changes:
- Extend
ProcessorwithforwardAmount(token, amount)and enrich theForwardedevent to include the forwarded amount. - Add
Netter(andIProcessor) plus a full test suite to net two processors’ balances using oracle-based value equality checks. - Add deployment wiring (
deployNetter.ts, scripts/package.json entries) and new forwarding tests forProcessorandStashDexProcessor.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/Processor.sol | Adds forwardAmount and updates Forwarded event to include the forwarded amount. |
| contracts/Netter.sol | New netting contract that validates oracle value equality and forwards amounts via processors. |
| contracts/interfaces/IProcessor.sol | New minimal interface used by Netter to query TARGET_ASSET and call forwardAmount. |
| test/Processor.ts | Updates Forwarded event assertions and adds coverage for forwardAmount. |
| test/StashDexProcessor.ts | Adds tests for forwardAmount behavior with StashDex repayment side-effects. |
| test/Netter.ts | New test suite covering access control, oracle equality checks, and forwarding behavior. |
| scripts/deployNetter.ts | New deployment script for Netter, including optional granting of processor CALLER_ROLE. |
| scripts/test.ts | Includes Netter deployment in the scripted “test deploy” flow. |
| package.json | Adds deploy + dry-run npm scripts for Netter. |
| coverage-baseline.json | Updates baseline coverage figures after new code/tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Closes: #247
This implementation assumes that Processors called by netter will share the same RECEIVER (StashDex or Repayer), so funds could just be moved there.