Repository navigation
feat(subgraph): add a gateway cut on query fees - #1407
Draft
MoonBoi9001 wants to merge 4 commits into
Draft
MoonBoi9001 wants to merge 4 commits into
MoonBoi9001 wants to merge 4 commits into
Conversation
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 Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.