diff --git a/api/src/consts.rs b/api/src/consts.rs index 46f51b2..786bf35 100644 --- a/api/src/consts.rs +++ b/api/src/consts.rs @@ -135,6 +135,3 @@ pub const TREASURY_TOKENS_ADDRESS: Pubkey = Pubkey::new_from_array( ) .0, ); - -/// The address of the CU-optimized Solana noop program. -pub const NOOP_PROGRAM_ID: Pubkey = pubkey!("noop8ytexvkpCuqbf6FB89BSuNemHtPRqaNC31GWivW"); diff --git a/api/src/sdk.rs b/api/src/sdk.rs index c47e287..ef00b2e 100644 --- a/api/src/sdk.rs +++ b/api/src/sdk.rs @@ -1,19 +1,6 @@ use steel::*; -use crate::{ - consts::*, - instruction::*, - state::{config_pda, proof_pda, treasury_pda}, -}; - -/// Builds an auth instruction. -pub fn auth(proof: Pubkey) -> Instruction { - Instruction { - program_id: NOOP_PROGRAM_ID, - accounts: vec![], - data: proof.to_bytes().to_vec(), - } -} +use crate::{consts::*, instruction::*, state::proof_pda}; /// Builds a claim instruction. pub fn claim(signer: Pubkey, beneficiary: Pubkey, amount: u64) -> Instruction { @@ -128,51 +115,22 @@ pub fn update(signer: Pubkey, miner: Pubkey) -> Instruction { } // Builds an initialize instruction. -// pub fn initialize(signer: Pubkey) -> Instruction { -// let bus_pdas = [ -// bus_pda(0), -// bus_pda(1), -// bus_pda(2), -// bus_pda(3), -// bus_pda(4), -// bus_pda(5), -// bus_pda(6), -// bus_pda(7), -// ]; -// let config_pda = config_pda(); -// let mint_pda = Pubkey::find_program_address(&[MINT, MINT_NOISE.as_slice()], &crate::ID); -// let treasury_pda = treasury_pda(); -// let metadata_pda = Pubkey::find_program_address( -// &[ -// METADATA, -// mpl_token_metadata::ID.as_ref(), -// mint_pda.0.as_ref(), -// ], -// &mpl_token_metadata::ID, -// ); -// Instruction { -// program_id: crate::ID, -// accounts: vec![ -// AccountMeta::new(signer, true), -// AccountMeta::new(bus_pdas[0].0, false), -// AccountMeta::new(bus_pdas[1].0, false), -// AccountMeta::new(bus_pdas[2].0, false), -// AccountMeta::new(bus_pdas[3].0, false), -// AccountMeta::new(bus_pdas[4].0, false), -// AccountMeta::new(bus_pdas[5].0, false), -// AccountMeta::new(bus_pdas[6].0, false), -// AccountMeta::new(bus_pdas[7].0, false), -// AccountMeta::new(config_pda.0, false), -// AccountMeta::new(metadata_pda.0, false), -// AccountMeta::new(mint_pda.0, false), -// AccountMeta::new(treasury_pda.0, false), -// AccountMeta::new(TREASURY_TOKENS_ADDRESS, false), -// 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(mpl_token_metadata::ID, false), -// AccountMeta::new_readonly(sysvar::rent::ID, false), -// ], -// data: Initialize {}.to_bytes(), -// } -// } +pub fn initialize(signer: Pubkey) -> Instruction { + Instruction { + program_id: crate::ID, + accounts: vec![ + AccountMeta::new(signer, true), + AccountMeta::new(CONFIG_ADDRESS, false), + AccountMeta::new(METADATA_ADDRESS, false), + AccountMeta::new(MINT_ADDRESS, false), + AccountMeta::new(TREASURY_ADDRESS, false), + AccountMeta::new(TREASURY_TOKENS_ADDRESS, false), + 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(mpl_token_metadata::ID, false), + AccountMeta::new_readonly(sysvar::rent::ID, false), + ], + data: Initialize {}.to_bytes(), + } +} diff --git a/program/src/reset.rs b/program/src/reset.rs index eb80445..0cbc55d 100644 --- a/program/src/reset.rs +++ b/program/src/reset.rs @@ -83,7 +83,6 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul /// This function calculates the block reward (ORE / min) based on the current supply. /// It is designed to reduce emissions by 10% approximately every 12 months with a hard stop at 5 million ORE. pub(crate) fn get_block_reward(current_supply: u64) -> u64 { - let max_supply = ONE_ORE * 5_000_000; match current_supply { n if n < ONE_ORE * 525_600 => 100_000_000_000, // Year ~1 n if n < ONE_ORE * 998_640 => 90_000_000_000, // Year ~2 @@ -113,7 +112,7 @@ pub(crate) fn get_block_reward(current_supply: u64) -> u64 { n if n < ONE_ORE * 4_916_405 => 7_178_979_874, // Year ~26 n if n < ONE_ORE * 4_950_365 => 6_461_081_886, // Year ~27 n if n < ONE_ORE * 4_980_928 => 5_814_973_607, // Year ~28 - n if n < max_supply => 5_233_476_327.min(max_supply - current_supply), // Year ~29 + n if n < MAX_SUPPLY => 5_233_476_327.min(MAX_SUPPLY - current_supply), // Year ~29 _ => 0, } }