Skip to content

Add rate-limited ERC-20 transfers sponsoring#18

Merged
thaarok merged 11 commits into
mainfrom
jk/free-stablecoins
Jun 15, 2026
Merged

Add rate-limited ERC-20 transfers sponsoring#18
thaarok merged 11 commits into
mainfrom
jk/free-stablecoins

Conversation

@thaarok

@thaarok thaarok commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

TokenTransferSubsidies - Rate-limited sponsoring of transfers for everybody

  • limited txs per token per day
  • whitelisted ERC-20 tokens, native tokens if whitelisted

SenderProjectSubsidies - Rate-limited sponsoring of transfers of whitelisted senders

  • limited txs per project (group of senders) per day
  • whitelisted ERC-20 tokens, native tokens if whitelisted (single whitelist for all projects)

@thaarok
thaarok force-pushed the jk/free-stablecoins branch 2 times, most recently from 802f34e to ad50422 Compare June 5, 2026 08:50
@thaarok
thaarok requested a review from Copilot June 5, 2026 08:50

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

This PR extends the gas-subsidy system to support rate-limited ERC-20 transfer sponsorship via a delegate “extension” contract. It changes the SubsidiesRegistry sponsorship selection API to return a mode + payload (fund-based vs tracked) and introduces a track() callback path for sponsorships that don’t deduct from a fund directly.

Changes:

  • Update ISubsidiesRegistry.chooseFund to return (mode, payload) and add track(trackingId, fee) to support tracked sponsorship.
  • Add SubsidiesRegistry delegate support (delegate, setDelegate) to forward chooseFund/deductFees/track when the base registry can’t sponsor.
  • Add FreeTransfersSubsidyExtension implementing a leaky-bucket daily limit for ERC-20 transfer(...) calls, plus comprehensive tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
contracts/sfc/SubsidiesRegistry.sol Adds delegate forwarding, new track() entrypoint, and changes chooseFund return shape to support tracked sponsorship.
contracts/sfc/FreeTransfersSubsidyExtension.sol New UUPS extension contract implementing rate-limited ERC-20 transfer sponsorship via tracking IDs.
contracts/interfaces/ISubsidiesRegistry.sol Introduces subsidy mode constants, updates chooseFund signature, adds track() to the core interface.
contracts/interfaces/ISubsidiesExtension.sol New interface for delegate extensions (chooseFund/deductFees/track).
test/SubsidiesRegistry.ts Updates tests for (mode, payload) return and adds a storage-layout stability check for existing slots.
test/FreeTransferSubsidyExtension.ts New tests covering free-transfer sponsorship, leaky-bucket behavior, and access control.
ignition/modules/FreeTransferSubsidyExtension.ts Adds an Ignition deployment module for the extension (currently has a contract-name mismatch).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contracts/sfc/SubsidiesRegistry.sol Outdated
Comment thread contracts/sfc/SubsidiesRegistry.sol Outdated
Comment thread contracts/sfc/FreeTransfersSubsidyExtension.sol Outdated
Comment thread test/SubsidiesRegistry.ts Outdated
Comment thread ignition/modules/FreeTransferSubsidyExtension.ts Outdated
@thaarok
thaarok force-pushed the jk/free-stablecoins branch from 1d7db6e to 234742f Compare June 5, 2026 09:14
Comment thread contracts/sfc/FreeTransfersSubsidyExtension.sol Outdated
@thaarok
thaarok force-pushed the jk/free-stablecoins branch from 981aced to 4ae382b Compare June 10, 2026 12:51
@thaarok
thaarok marked this pull request as ready for review June 12, 2026 13:33
@thaarok
thaarok merged commit 8a986b4 into main Jun 15, 2026
2 checks passed
@thaarok
thaarok deleted the jk/free-stablecoins branch June 15, 2026 07:20
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.

3 participants