offer.rs 585 B

1234567891011121314151617181920212223242526
  1. use steel::*;
  2. use crate::consts::OFFER_SEED;
  3. use super::EscrowAccount;
  4. /// Fetch PDA of the counter account.
  5. pub fn offer_pda(maker: Pubkey, id: u64) -> (Pubkey, u8) {
  6. Pubkey::find_program_address(
  7. &[OFFER_SEED, maker.as_ref(), id.to_le_bytes().as_ref()],
  8. &crate::id(),
  9. )
  10. }
  11. #[repr(C)]
  12. #[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
  13. pub struct Offer {
  14. pub id: [u8; 8],
  15. pub maker: Pubkey,
  16. pub token_mint_a: Pubkey,
  17. pub token_mint_b: Pubkey,
  18. pub token_b_wanted_amount: [u8; 8],
  19. pub bump: u8,
  20. }
  21. account!(EscrowAccount, Offer);