mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 15:10:13 +00:00
open
This commit is contained in:
@@ -11,6 +11,9 @@ pub fn open(signer: Pubkey, id: u64) -> Instruction {
|
||||
let block_adddress = block_pda(id).0;
|
||||
let market_address = market_pda(id).0;
|
||||
let base_mint_address = mint_pda(id).0;
|
||||
let collateral_address = get_associated_token_address(&block_adddress, &MINT_ADDRESS);
|
||||
let commitment_address = get_associated_token_address(&block_adddress, &base_mint_address);
|
||||
let sender_address = get_associated_token_address(&signer, &MINT_ADDRESS);
|
||||
let vault_base_address = get_associated_token_address(&market_address, &base_mint_address);
|
||||
let vault_quote_address = get_associated_token_address(&market_address, &MINT_ADDRESS);
|
||||
Instruction {
|
||||
@@ -18,9 +21,13 @@ pub fn open(signer: Pubkey, id: u64) -> Instruction {
|
||||
accounts: vec![
|
||||
AccountMeta::new(signer, true),
|
||||
AccountMeta::new(block_adddress, false),
|
||||
AccountMeta::new(collateral_address, false),
|
||||
AccountMeta::new(commitment_address, false),
|
||||
AccountMeta::new(market_address, false),
|
||||
AccountMeta::new(base_mint_address, false),
|
||||
AccountMeta::new(MINT_ADDRESS, false),
|
||||
AccountMeta::new(sender_address, false),
|
||||
AccountMeta::new(TREASURY_ADDRESS, false),
|
||||
AccountMeta::new(vault_base_address, false),
|
||||
AccountMeta::new(vault_quote_address, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
|
||||
@@ -34,7 +34,7 @@ pub fn process_open(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
|
||||
sender_info
|
||||
.is_writable()?
|
||||
.as_associated_token_account(&signer_info.key, &mint_quote_info.key)?
|
||||
.assert_mut(|t| t.amount() >= OPEN_FEE)?;
|
||||
.assert(|t| t.amount() >= OPEN_FEE)?;
|
||||
treasury_info.has_address(&TREASURY_ADDRESS)?;
|
||||
system_program.is_program(&system_program::ID)?;
|
||||
token_program.is_program(&spl_token::ID)?;
|
||||
|
||||
Reference in New Issue
Block a user