Claim fee (#136)

* claim fee

* migration

* migrate

* sdk

* disable fee

* disable claim fee

* cleanup

* cleanup

* fix

* cleanup

* stake

* cleanup

* cleanup

* cleanup

* hour
This commit is contained in:
Hardhat Chad
2025-10-07 18:28:26 -05:00
committed by GitHub
parent bbfbb82157
commit d4b4db8927
9 changed files with 67 additions and 23 deletions

View File

@@ -1,6 +1,6 @@
use steel::*;
use crate::state::miner_pda;
use crate::state::{miner_pda, Treasury};
use super::OreAccount;
@@ -42,6 +42,19 @@ impl Miner {
pub fn pda(&self) -> (Pubkey, u8) {
miner_pda(self.authority)
}
pub fn claim_ore(&mut self, amount: u64, treasury: &mut Treasury) -> u64 {
let amount = self.rewards_ore.min(amount);
self.rewards_ore -= amount;
treasury.total_unclaimed -= amount;
amount
}
pub fn claim_sol(&mut self, amount: u64) -> u64 {
let amount = self.rewards_sol.min(amount);
self.rewards_sol -= amount;
amount
}
}
account!(OreAccount, Miner);

View File

@@ -16,8 +16,11 @@ pub struct Treasury {
/// The cumulative ORE distributed to stakers, divided by the total stake at the time of distribution.
pub rewards_factor: Numeric,
/// The current total amount of ORE staked.
/// The current total amount of ORE staking deposits.
pub total_staked: u64,
/// The current total amount of unclaimed ORE mining rewards.
pub total_unclaimed: u64,
}
account!(OreAccount, Treasury);