Created
April 9, 2022 03:12
-
-
Save alecchendev/5a456b42db7c83d732f6c203f013a443 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in `state.rs` | |
use borsh::{BorshDeserialize, BorshSerialize}; | |
use solana_program::pubkey::Pubkey; | |
#[derive(BorshSerialize, BorshDeserialize, Debug, Clone)] | |
pub struct Pool { | |
pub mint_a: Pubkey, | |
pub mint_b: Pubkey, | |
pub mint: Pubkey, | |
pub fee: u64, | |
pub fee_decimals: u64, | |
} | |
// code inside of `process_instruction` | |
// pool_account is of type `AccountInfo` retrieved previously | |
let pool = Pool::try_from_slice(&pool_account.try_borrow_data()?)?; | |
msg!("pool fee: {}", pool.fee); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment