mirror of
https://github.com/d0zingcat/ore.git
synced 2026-05-15 15:10:19 +00:00
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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user