This commit is contained in:
Hardhat Chad
2025-07-10 13:58:09 -07:00
parent 13583b4b46
commit b29ba4b5d1
2 changed files with 30 additions and 17 deletions

View File

@@ -35,7 +35,7 @@ pub fn open(signer: Pubkey, id: u64) -> Instruction {
AccountMeta::new_readonly(system_program::ID, false),
AccountMeta::new_readonly(spl_token::ID, false),
AccountMeta::new_readonly(spl_associated_token_account::ID, false),
AccountMeta::new_readonly(ore_api::ID, false),
AccountMeta::new_readonly(crate::ID, false),
AccountMeta::new_readonly(sysvar::rent::ID, false),
],
data: Open {

View File

@@ -313,27 +313,40 @@ pub fn process_open(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResult
&[BLOCK, &id.to_le_bytes()],
)?;
let msg = OpenEvent {
disc: OreEvent::Open as u64,
id,
start_slot,
signer: *signer_info.key,
reward_config: block.reward,
liquidity_base: market.base.liquidity() as u64,
liquidity_quote: market.quote.liquidity() as u64,
ts: clock.unix_timestamp,
}
.to_bytes();
// let msg = OpenEvent {
// disc: OreEvent::Open as u64,
// id,
// start_slot,
// signer: *signer_info.key,
// reward_config: block.reward,
// liquidity_base: market.base.liquidity() as u64,
// liquidity_quote: market.quote.liquidity() as u64,
// ts: clock.unix_timestamp,
// }
// .to_bytes();
invoke_signed(
&ore_api::sdk::log(*block_info.key, &msg),
&[block_info, ore_program],
&crate::ID,
&[BLOCK, &block_id.to_le_bytes()],
&ore_api::sdk::log(
*block_info.key,
&OpenEvent {
disc: OreEvent::Open as u64,
id,
start_slot,
signer: *signer_info.key,
reward_config: block.reward,
liquidity_base: market.base.liquidity() as u64,
liquidity_quote: market.quote.liquidity() as u64,
ts: clock.unix_timestamp,
}
.to_bytes(),
),
&[block_info.clone(), ore_program.clone()],
&ore_api::ID,
&[BLOCK, &id.to_le_bytes()],
)?;
// Emit event.
program_log(id, block_info.clone(), &msg)?;
// program_log(id, block_info.clone(), &msg)?;
Ok(())
}