mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-16 15:10:20 +00:00
atas
This commit is contained in:
@@ -50,6 +50,56 @@ pub fn mint_pda(id: u64) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(&[MINT, &id.to_le_bytes()], &crate::ID)
|
||||
}
|
||||
|
||||
pub fn collateral_pda(block_id: u64) -> (Pubkey, u8) {
|
||||
let block_address = block_pda(block_id).0;
|
||||
Pubkey::find_program_address(
|
||||
&[
|
||||
&block_address.to_bytes(),
|
||||
&spl_token::ID.to_bytes(),
|
||||
&MINT_ADDRESS.to_bytes(),
|
||||
],
|
||||
&crate::ID,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn commitment_pda(block_id: u64) -> (Pubkey, u8) {
|
||||
let block_address = block_pda(block_id).0;
|
||||
let mint_address = mint_pda(block_id).0;
|
||||
Pubkey::find_program_address(
|
||||
&[
|
||||
&block_address.to_bytes(),
|
||||
&spl_token::ID.to_bytes(),
|
||||
&mint_address.to_bytes(),
|
||||
],
|
||||
&crate::ID,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn vault_base_pda(block_id: u64) -> (Pubkey, u8) {
|
||||
let market_address = market_pda(block_id).0;
|
||||
let mint_address = mint_pda(block_id).0;
|
||||
Pubkey::find_program_address(
|
||||
&[
|
||||
&market_address.to_bytes(),
|
||||
&spl_token::ID.to_bytes(),
|
||||
&mint_address.to_bytes(),
|
||||
],
|
||||
&crate::ID,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn vault_quote_pda(block_id: u64) -> (Pubkey, u8) {
|
||||
let market_address = market_pda(block_id).0;
|
||||
Pubkey::find_program_address(
|
||||
&[
|
||||
&market_address.to_bytes(),
|
||||
&spl_token::ID.to_bytes(),
|
||||
&MINT_ADDRESS.to_bytes(),
|
||||
],
|
||||
&crate::ID,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn permit_pda(authority: Pubkey, block_id: u64) -> (Pubkey, u8) {
|
||||
Pubkey::find_program_address(
|
||||
&[PERMIT, &authority.to_bytes(), &block_id.to_le_bytes()],
|
||||
|
||||
Reference in New Issue
Block a user