mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-16 15:10:20 +00:00
no truncation logs
This commit is contained in:
@@ -8,16 +8,17 @@ pub enum OreInstruction {
|
||||
Close = 1,
|
||||
Commit = 2,
|
||||
Deposit = 3,
|
||||
Mine = 4,
|
||||
Swap = 5,
|
||||
Uncommit = 6,
|
||||
Withdraw = 7,
|
||||
Log = 4,
|
||||
Mine = 5,
|
||||
Swap = 6,
|
||||
Uncommit = 7,
|
||||
Withdraw = 8,
|
||||
|
||||
// Admin
|
||||
SetAdmin = 8,
|
||||
SetBlockLimit = 9,
|
||||
SetFeeCollector = 10,
|
||||
SetFeeRate = 11,
|
||||
SetAdmin = 9,
|
||||
SetBlockLimit = 10,
|
||||
SetFeeCollector = 11,
|
||||
SetFeeRate = 12,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
@@ -45,6 +46,10 @@ pub struct Deposit {
|
||||
pub amount: [u8; 8],
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct Log {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct Mine {
|
||||
@@ -99,6 +104,7 @@ instruction!(OreInstruction, Open);
|
||||
instruction!(OreInstruction, Close);
|
||||
instruction!(OreInstruction, Commit);
|
||||
instruction!(OreInstruction, Deposit);
|
||||
instruction!(OreInstruction, Log);
|
||||
instruction!(OreInstruction, Mine);
|
||||
instruction!(OreInstruction, Swap);
|
||||
instruction!(OreInstruction, Uncommit);
|
||||
|
||||
@@ -2,7 +2,7 @@ use spl_associated_token_account::get_associated_token_address;
|
||||
use steel::*;
|
||||
|
||||
use crate::{
|
||||
consts::{MINT_ADDRESS, TREASURY_ADDRESS},
|
||||
consts::{BLOCK, MINT_ADDRESS, TREASURY_ADDRESS},
|
||||
instruction::*,
|
||||
state::*,
|
||||
};
|
||||
@@ -87,6 +87,25 @@ pub fn close(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log(signer: Pubkey, msg: &[u8]) -> Instruction {
|
||||
let mut data = Log {}.to_bytes();
|
||||
data.extend_from_slice(msg);
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![AccountMeta::new(signer, true)],
|
||||
data: data,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn program_log(block_id: u64, block_info: AccountInfo, msg: &[u8]) -> Result<(), ProgramError> {
|
||||
invoke_signed(
|
||||
&log(*block_info.key, msg),
|
||||
&[block_info.clone()],
|
||||
&crate::ID,
|
||||
&[BLOCK, &block_id.to_le_bytes()],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn mine(signer: Pubkey, id: u64, amount: u64) -> Instruction {
|
||||
let block_adddress = block_pda(id).0;
|
||||
let market_address = market_pda(id).0;
|
||||
|
||||
Reference in New Issue
Block a user