Skip to content

feat(subgraph): add a gateway cut on query fees - #1407

Draft
MoonBoi9001 wants to merge 4 commits into
mainfrom
mb9/add-protocol-cut-on-gateway-query-fees
Draft

MoonBoi9001 wants to merge 4 commits into
mainfrom
mb9/add-protocol-cut-on-gateway-query-fees

Conversation

@MoonBoi9001

@MoonBoi9001 MoonBoi9001 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

This lets the Subgraph Service owner take a cut of every query fee payment and send it to a set address, so the protocol earns from gateway query volume on-chain instead of through off-chain agreements. The gateway pays the same amount either way, since the cut comes out of what indexers and delegators receive, and it defaults to 0. With production compiler settings the contract grows by 209 bytes, leaving 1,538 bytes under the size limit.

The Subgraph Service could only take a cut of query fees for curators, so gateways paid nothing
to the protocol. The owner can now set a gateway cut and a destination, and every query fee
collection sends that share there, taken alongside the curation cut after the protocol tax.
Every query fee collection reads the gateway cut and its destination. Storing the cut as a
32-bit number puts both in 1 storage slot, saving a slot read (about 2,100 gas) per collection.
The query fee split helper named its parameter after an existing function, which made the
compiler warn on every build.
The payer of a query fee pays the same amount whatever the gateway cut is, so the docs now say
indexers and delegators bear it, and that the curation cut setter can reject a cut over 100%.
@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.50%. Comparing base (3c7ca93) to head (fd8782c).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ges/subgraph-service/contracts/SubgraphService.sol 96.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1407      +/-   ##
==========================================
+ Coverage   91.47%   91.50%   +0.02%     
==========================================
  Files          81       81              
  Lines        5326     5342      +16     
  Branches      973      978       +5     
==========================================
+ Hits         4872     4888      +16     
  Misses        433      433              
  Partials       21       21              
Flag Coverage Δ
unittests 91.50% <96.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant