feat: configurable fees receiver #90
Open
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.
Problem
Enable permissionless protocol fee claiming.
Solution
Stores the fee receiver in the ProgramConfig. Remove admin checks for claiming. Send protocol fees to the stored fee receiver.
Deploy Notes
The
set_fees_receiver
instruction must be called by the admin when deploying this PR as other methods relying on the ProgramConfig would fail otherwise.Greptile Summary
Updated On: 2025-09-15 16:53:17 UTC
This PR implements configurable fees receiver functionality that enables permissionless protocol fee claiming. The core change modifies the
ProgramConfig
struct to include a newfees_receiver
field, allowing protocol fees to be sent to a designated address instead of always going to the program update authority.Key architectural changes include:
Account Structure Changes:
ProgramConfig
with afees_receiver: Pubkey
field (+32 bytes)process_set_fees_receiver
to handle existing accountsProtocol Fee Claiming Refactor:
protocol_claim_fees
protocol_claim_fees(admin: Pubkey)
toprotocol_claim_fees(fees_receiver: Pubkey, program: Pubkey)
New Instruction Implementation:
SetFeesReceiver
discriminator (value 16) and corresponding processorSetFeesReceiverArgs
struct to pass the new fees receiver addressset_fees_receiver
instruction that migrates existing configsIntegration Changes:
@magicblock-labs/ephemeral-rollups-sdk
v0.2.10)The change enables automatic fee distribution systems and makes the protocol more adaptable for staking program integration. The migration mechanism ensures backward compatibility during deployment by detecting old account formats and upgrading them with default values.
Confidence score: 3/5
src/processor/set_fees_receiver.rs
and the updated fee claiming mechanism insrc/processor/protocol_claim_fees.rs