amm.rs 522 B

1234567891011121314151617181920212223
  1. use steel::*;
  2. use super::TokenSwapAccount;
  3. /// Fetch PDA of the amm account.
  4. pub fn amm_pda(id: Pubkey) -> (Pubkey, u8) {
  5. Pubkey::find_program_address(&[id.as_ref()], &crate::id())
  6. }
  7. #[repr(C)]
  8. #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
  9. pub struct Amm {
  10. /// The primary key of the AMM
  11. pub id: Pubkey,
  12. /// Account that has admin authority over the AMM
  13. pub admin: Pubkey,
  14. /// The LP fee taken on each trade, in basis points
  15. pub fee: [u8; 2],
  16. }
  17. account!(TokenSwapAccount, Amm);