Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combined protocol "program" fees #244

Merged
merged 37 commits into from
Oct 21, 2024
Merged

Combined protocol "program" fees #244

merged 37 commits into from
Oct 21, 2024

Conversation

jgur-psyops
Copy link
Contributor

@jgur-psyops jgur-psyops commented Sep 5, 2024

Replaces #243 and #223

In addition to what is already covered in those PRs:

The FeeState account (unique per program) now administers "program fees", which go directly to the FeeState.global_fee_wallet's canonical ATA for any given bank's mint. For example, if a third party opens a new group and a new bank, the program fee will always go to get_associated_token_address(FeeState.global_fee_wallet, bank.mint).

Groups will cache the program fees and the fee state's global fee wallet, which the global fee admin can change at any time. When fees update, they will propagate to groups using the permissionless propagate_fee ix.

The global fee state admin can enable/disable program fees for any group without the group admin's permission.

Note that fees which go to the group are still called "protocol" or "group" fees for legacy purposes. The new fees are always referred to as "program" fees.

FE/API considerations:

  • The ATA must exist before collect_bank_fees can be called.
  • Adds accounts to marginfi_group_initialize and lending_pool_collect_bank_fees (due to hard coded seed derivation of FeeState, all added accounts are anchor inferred, and thus should be seamless if using program.methods syntax)

WIP:

  • CLI fixes
  • Fuzz

@jgur-psyops jgur-psyops changed the title Combined protocol fees Combined protocol "program" fees Sep 5, 2024
This was referenced Sep 6, 2024
@jkbpvsc
Copy link
Member

jkbpvsc commented Sep 6, 2024

Can we add a group and a bank level flag to disable program fees for groups that we own?
The flag should only be able to be flipped by some program level authority.

@jgur-psyops jgur-psyops merged commit 8a01852 into main Oct 21, 2024
4 checks passed
@jgur-psyops jgur-psyops deleted the combined-protocol-fees branch October 21, 2024 14:58
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.

2 participants