mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-14 07:26:51 +00:00
response data
This commit is contained in:
@@ -34,6 +34,7 @@ pub fn process_initialize<'a, 'info>(
|
||||
return Err(ProgramError::NotEnoughAccountKeys);
|
||||
};
|
||||
load_signer(signer)?;
|
||||
// TODO Verify bus keys
|
||||
load_uninitialized_pda(bus_0_info, &[BUS, &[0], &[args.bus_0_bump]])?;
|
||||
load_uninitialized_pda(bus_0_info, &[BUS, &[0], &[args.bus_0_bump]])?;
|
||||
load_uninitialized_pda(bus_0_info, &[BUS, &[0], &[args.bus_0_bump]])?;
|
||||
@@ -43,7 +44,6 @@ pub fn process_initialize<'a, 'info>(
|
||||
load_uninitialized_pda(bus_0_info, &[BUS, &[0], &[args.bus_0_bump]])?;
|
||||
load_uninitialized_pda(bus_0_info, &[BUS, &[0], &[args.bus_0_bump]])?;
|
||||
load_uninitialized_pda(mint_info, &[MINT, &[args.mint_bump]])?;
|
||||
// TODO Verify keys
|
||||
if !mint_info.key.eq(&MINT_ADDRESS) {
|
||||
return Err(ProgramError::InvalidAccountData);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ pub fn process_mine<'a, 'info>(
|
||||
proof.total_hashes = proof.total_hashes.saturating_add(1);
|
||||
proof.total_rewards = proof.total_rewards.saturating_add(1);
|
||||
|
||||
// Set return data
|
||||
// Log the mined rewards
|
||||
set_return_data(treasury.reward_rate.to_le_bytes().as_slice());
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use solana_program::{
|
||||
account_info::AccountInfo, clock::Clock, entrypoint::ProgramResult,
|
||||
account_info::AccountInfo, clock::Clock, entrypoint::ProgramResult, program::set_return_data,
|
||||
program_error::ProgramError, pubkey::Pubkey, sysvar::Sysvar,
|
||||
};
|
||||
|
||||
@@ -88,8 +89,6 @@ pub fn process_reset<'a, 'info>(
|
||||
&[&[TREASURY, &[treasury_bump]]],
|
||||
)?;
|
||||
|
||||
// TODO Logs?
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -113,6 +112,13 @@ pub(crate) fn calculate_new_reward_rate(current_rate: u64, epoch_rewards: u64) -
|
||||
new_rate_smoothed.max(1).min(BUS_EPOCH_REWARDS)
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Pod, Zeroable)]
|
||||
pub struct ResetResponse {
|
||||
pub new_reward_rate: u64,
|
||||
pub new_supply: u64,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{calculate_new_reward_rate, SMOOTHING_FACTOR, TARGET_EPOCH_REWARDS};
|
||||
|
||||
Reference in New Issue
Block a user