mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-19 15:10:29 +00:00
localnet
This commit is contained in:
@@ -3,22 +3,8 @@ use steel::*;
|
||||
#[derive(Debug, Error, Clone, Copy, PartialEq, Eq, IntoPrimitive)]
|
||||
#[repr(u32)]
|
||||
pub enum OreError {
|
||||
#[error("The epoch has ended and needs reset")]
|
||||
NeedsReset = 0,
|
||||
#[error("The provided hash is invalid")]
|
||||
HashInvalid = 1,
|
||||
#[error("The provided hash did not satisfy the minimum required difficulty")]
|
||||
HashTooEasy = 2,
|
||||
#[error("The claim amount cannot be greater than the claimable rewards")]
|
||||
ClaimTooLarge = 3,
|
||||
#[error("The clock time is invalid")]
|
||||
ClockInvalid = 4,
|
||||
#[error("You are trying to submit too soon")]
|
||||
Spam = 5,
|
||||
#[error("The maximum supply has been reached")]
|
||||
MaxSupply = 6,
|
||||
#[error("The proof does not match the expected account")]
|
||||
AuthFailed = 7,
|
||||
#[error("Placeholder error")]
|
||||
Dummy = 0,
|
||||
}
|
||||
|
||||
error!(OreError);
|
||||
|
||||
@@ -86,12 +86,12 @@ pub fn close(signer: Pubkey, wager: Pubkey) -> Instruction {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn initialize(signer: Pubkey, mint: Pubkey, ore_mint: Pubkey) -> Instruction {
|
||||
pub fn initialize(signer: Pubkey) -> Instruction {
|
||||
let block = block_pda().0;
|
||||
let block_bets =
|
||||
spl_associated_token_account::get_associated_token_address(&signer, &native_mint::ID);
|
||||
spl_associated_token_account::get_associated_token_address(&block, &native_mint::ID);
|
||||
let block_ore =
|
||||
spl_associated_token_account::get_associated_token_address(&signer, &MINT_ADDRESS);
|
||||
spl_associated_token_account::get_associated_token_address(&block, &MINT_ADDRESS);
|
||||
Instruction {
|
||||
program_id: crate::ID,
|
||||
accounts: vec![
|
||||
@@ -99,8 +99,8 @@ pub fn initialize(signer: Pubkey, mint: Pubkey, ore_mint: Pubkey) -> Instruction
|
||||
AccountMeta::new(block, false),
|
||||
AccountMeta::new(block_bets, false),
|
||||
AccountMeta::new(block_ore, false),
|
||||
AccountMeta::new(mint, false),
|
||||
AccountMeta::new(ore_mint, false),
|
||||
AccountMeta::new_readonly(MINT_ADDRESS, false),
|
||||
AccountMeta::new_readonly(native_mint::ID, false),
|
||||
AccountMeta::new_readonly(system_program::ID, false),
|
||||
AccountMeta::new_readonly(spl_token::ID, false),
|
||||
AccountMeta::new_readonly(spl_associated_token_account::ID, false),
|
||||
|
||||
@@ -5,12 +5,12 @@ use super::OreAccount;
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||
pub struct Block {
|
||||
/// The current round.
|
||||
pub current_round: u64,
|
||||
|
||||
/// The number of bets made in the current round.
|
||||
pub bet_count: u64,
|
||||
|
||||
/// The current round.
|
||||
pub current_round: u64,
|
||||
|
||||
/// The slot at which the current round ends.
|
||||
pub ends_at: u64,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user