mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-13 23:16:52 +00:00
log
This commit is contained in:
@@ -2,7 +2,6 @@ use steel::*;
|
||||
|
||||
pub enum OreEvent {
|
||||
Reset = 0,
|
||||
Mine = 2,
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
@@ -11,11 +10,8 @@ pub struct ResetEvent {
|
||||
/// The event discriminator.
|
||||
pub disc: u64,
|
||||
|
||||
/// The authority of the swap.
|
||||
pub authority: Pubkey,
|
||||
|
||||
/// The block that was opened for trading.
|
||||
pub block_id: u64,
|
||||
pub round_id: u64,
|
||||
|
||||
/// The start slot of the next block.
|
||||
pub start_slot: u64,
|
||||
@@ -23,34 +19,26 @@ pub struct ResetEvent {
|
||||
/// The end slot of the next block.
|
||||
pub end_slot: u64,
|
||||
|
||||
/// The timestamp of the event.
|
||||
pub ts: i64,
|
||||
}
|
||||
/// The winning square of the round.
|
||||
pub winning_square: u64,
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
|
||||
pub struct MineEvent {
|
||||
/// The event discriminator.
|
||||
pub disc: u64,
|
||||
/// The top miner of the round.
|
||||
pub top_miner: Pubkey,
|
||||
|
||||
/// The authority of the mine.
|
||||
pub authority: Pubkey,
|
||||
/// The total amount of SOL prospected in the round.
|
||||
pub total_prospects: u64,
|
||||
|
||||
/// The block that was mined.
|
||||
pub block_id: u64,
|
||||
/// The total amount of SOL put in the ORE vault.
|
||||
pub total_vaulted: u64,
|
||||
|
||||
/// The nonce that was mined.
|
||||
pub nonce: u64,
|
||||
/// The total amount of SOL won by miners for the round.
|
||||
pub total_winnings: u64,
|
||||
|
||||
/// The total hashpower the miner had.
|
||||
pub hashpower: u64,
|
||||
|
||||
/// Whether or not the miner is the new best.
|
||||
pub is_best: u64,
|
||||
/// The total amount of ORE minted for the round.
|
||||
pub total_minted: u64,
|
||||
|
||||
/// The timestamp of the event.
|
||||
pub ts: i64,
|
||||
}
|
||||
|
||||
event!(ResetEvent);
|
||||
event!(MineEvent);
|
||||
|
||||
@@ -8,12 +8,13 @@ pub enum OreInstruction {
|
||||
ClaimSOL = 1,
|
||||
ClaimORE = 2,
|
||||
Initialize = 3,
|
||||
Log = 4,
|
||||
Prospect = 5,
|
||||
Redeem = 6,
|
||||
Reset = 7,
|
||||
|
||||
// Admin
|
||||
SetAdmin = 8,
|
||||
SetAdmin = 9,
|
||||
SetFeeCollector = 10,
|
||||
|
||||
// Seeker
|
||||
@@ -42,7 +43,7 @@ pub struct Initialize {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct InitializeSquares {}
|
||||
pub struct Log {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
@@ -115,17 +116,14 @@ pub struct SetSniperFeeDuration {
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct ClaimSeeker {}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
|
||||
pub struct MigrateSquares {}
|
||||
|
||||
instruction!(OreInstruction, Boost);
|
||||
instruction!(OreInstruction, ClaimSOL);
|
||||
instruction!(OreInstruction, ClaimORE);
|
||||
instruction!(OreInstruction, Initialize);
|
||||
instruction!(OreInstruction, Log);
|
||||
instruction!(OreInstruction, Prospect);
|
||||
instruction!(OreInstruction, Redeem);
|
||||
instruction!(OreInstruction, Reset);
|
||||
instruction!(OreInstruction, Prospect);
|
||||
instruction!(OreInstruction, Initialize);
|
||||
instruction!(OreInstruction, SetAdmin);
|
||||
instruction!(OreInstruction, SetFeeCollector);
|
||||
instruction!(OreInstruction, ClaimSeeker);
|
||||
|
||||
@@ -2,11 +2,25 @@ use spl_associated_token_account::get_associated_token_address;
|
||||
use steel::*;
|
||||
|
||||
use crate::{
|
||||
consts::{BOOST_RESERVE_TOKEN, MINT_ADDRESS, TREASURY_ADDRESS},
|
||||
consts::{BOARD, BOOST_RESERVE_TOKEN, MINT_ADDRESS, TREASURY_ADDRESS},
|
||||
instruction::*,
|
||||
state::*,
|
||||
};
|
||||
|
||||
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(accounts: &[AccountInfo], msg: &[u8]) -> Result<(), ProgramError> {
|
||||
invoke_signed(&log(*accounts[0].key, msg), accounts, &crate::ID, &[BOARD])
|
||||
}
|
||||
|
||||
// let [signer_info, config_info, mint_info, reserve_tokens_info, treasury_info, system_program, token_program] =
|
||||
|
||||
pub fn boost(signer: Pubkey) -> Instruction {
|
||||
@@ -135,6 +149,7 @@ pub fn reset(signer: Pubkey, miners: Vec<Pubkey>) -> Instruction {
|
||||
AccountMeta::new(treasury_tokens_address, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
AccountMeta::new_readonly(spl_token::ID, false),
|
||||
AccountMeta::new_readonly(crate::ID, false),
|
||||
AccountMeta::new_readonly(sysvar::slot_hashes::ID, false),
|
||||
];
|
||||
for miner in miners {
|
||||
|
||||
Reference in New Issue
Block a user