-
Notifications
You must be signed in to change notification settings - Fork 75
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
Add permissioned markets #46
Conversation
metaproph3t
commented
May 23, 2023
- address Permissioned markets #33
79264a1
to
232da79
Compare
For [permissioned markets](#33), we need to store the `Pubkey`s of market authorities. Assuming that we do not want to require *all* markets to be permissioned, we will need to store both (1) whether or not this market has an authority and (2) the authority, if any. Traditionally, this would be done in an `Option<Pubkey>`, but we use [zero copy deserialization](https://docs.rs/anchor-lang/latest/anchor_lang/prelude/attr.zero_copy.html), which requires all types to implement `bytemuck::Pod`. `std::option::Option<T>` does not implement `Pod`, and because of the way enum bit patterns work in Rust, it cannot. So we need to add a custom option implementation that *does* implement `Pod`.
Store the various admins, such as `fee_collector`, `close_authority`, etc. inside the `Market` struct.
If an `open_orders_admin` is set inside a `Market`, require all orders submitted to that market to have the signature of the `open_orders_admin`.
Add an optional `consume_events_admin` to the market struct that, if present, must sign off on any consume event instruction.
2824ff8
to
487dc51
Compare
b994ad8
to
2649484
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me. Some users recommended us to have the admin as the seed of the Market. This PR removes it, but we could add instead the sweep admin?
/// Admin who can collect fees from the market | ||
pub collect_fee_admin: Pubkey, | ||
/// Admin who can manage the oracle | ||
pub manage_oracle_admin: PodOption<Pubkey>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This admin would be able to manage the oracle, which currently just means setting the stub oracle. I included it in case there was a use for it later (e.g., a change oracle instruction), but on second thought it seems that it should be removed from this PR and included later only if there's a defined use for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct
Certainly, I will fix this, sir. |
f799a5a
to
e0e1ecc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job, thanks a lot!!