Skip to content

Feat/netter#269

Merged
lastperson merged 3 commits into
mainfrom
feat/netter
Jul 2, 2026
Merged

Feat/netter#269
lastperson merged 3 commits into
mainfrom
feat/netter

Conversation

@lastperson

@lastperson lastperson commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

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.

@lastperson lastperson requested review from mj52951 and mpetrunic July 1, 2026 15:56
@lastperson lastperson self-assigned this Jul 1, 2026

@mj52951 mj52951 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@lastperson lastperson merged commit a7746d5 into main Jul 2, 2026
6 checks passed
@lastperson lastperson deleted the feat/netter branch July 2, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Processor with forwardAmount(token, amount) and enrich the Forwarded event to include the forwarded amount.
  • Add Netter (and IProcessor) 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 for Processor and StashDexProcessor.

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.

Comment thread contracts/Netter.sol
Comment thread contracts/Netter.sol
Comment thread contracts/Netter.sol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable processor netting: swap interface to exchange source tokens between processors

4 participants