Struct quarry_merge_mine::state::MergeMiner
source · [−]pub struct MergeMiner {
pub pool: Pubkey,
pub owner: Pubkey,
pub bump: u8,
pub index: u64,
pub primary_balance: u64,
pub replica_balance: u64,
}
Expand description
Enables mining multiple quarry_mine::Quarrys simultaneously with only one deposit.
To derive the address, use the following code:
&[
b"MergeMiner" as &[u8],
&$mm.pool.key().to_bytes(),
&$mm.owner.to_bytes(),
&[$mm.bump],
]
Deposits and withdrawals happen in token accounts owned by the MergeMiner. These accounts do not need to be ATAs; however, ATAs make the accounts easier to locate on the frontend.
The accounts serve as intermediate staging accounts for the merge miner: they are not staked and only exist to facilitate the merge miner’s operations.
Fields
pool: Pubkey
MergePool to mint against.
owner: Pubkey
Owner of the MergeMiner.
bump: u8
Bump seed.
index: u64
The index of the MergeMiner within the MergePool.
primary_balance: u64
Amount of tokens staked into the primary quarry.
replica_balance: u64
Amount of replica tokens that have been issued to this MergeMiner. Primary tokens may only be withdrawn if MergeMiner::primary_balance == 0 and MergeMiner::replica_balance == 0.
Implementations
sourceimpl MergeMiner
impl MergeMiner
sourcepub fn init_miner(&self, init: &InitMiner<'_>) -> Result<()>
pub fn init_miner(&self, init: &InitMiner<'_>) -> Result<()>
Initializes a quarry_mine::Miner for the MergeMiner.
sourcepub fn stake_max_primary_miner(
&self,
stake: &QuarryStakePrimary<'_>
) -> Result<u64>
pub fn stake_max_primary_miner(
&self,
stake: &QuarryStakePrimary<'_>
) -> Result<u64>
Stakes all available primary tokens owned by the MergeMiner into the primary miner. Returns the number of tokens deposited.
sourcepub fn stake_max_replica_miner(
&self,
stake: &QuarryStakeReplica<'_>
) -> Result<u64>
pub fn stake_max_replica_miner(
&self,
stake: &QuarryStakeReplica<'_>
) -> Result<u64>
Mints the maximum number of replica tokens for the crate::MergeMiner, staking them into a quarry_mine::Miner.
sourcepub fn unstake_primary_miner(
&self,
stake: &QuarryStakePrimary<'_>,
amount: u64
) -> Result<()>
pub fn unstake_primary_miner(
&self,
stake: &QuarryStakePrimary<'_>,
amount: u64
) -> Result<()>
Unstakes from the primary miner.
sourcepub fn unstake_all_and_burn_replica_miner(
&self,
stake: &QuarryStakeReplica<'_>
) -> Result<u64>
pub fn unstake_all_and_burn_replica_miner(
&self,
stake: &QuarryStakeReplica<'_>
) -> Result<u64>
Unstake tokens from a replica quarry_mine::Miner and burns the replica tokens.
sourcepub fn withdraw_tokens(
&self,
withdraw: &WithdrawTokens<'_>
) -> Result<WithdrawTokensEvent>
pub fn withdraw_tokens(
&self,
withdraw: &WithdrawTokens<'_>
) -> Result<WithdrawTokensEvent>
Withdraws tokens from the MergeMiner.
sourcepub fn claim_rewards(&self, claim: &ClaimRewards<'_>) -> Result<()>
pub fn claim_rewards(&self, claim: &ClaimRewards<'_>) -> Result<()>
Claims quarry_mine rewards as the MergeMiner.
sourceimpl MergeMiner
impl MergeMiner
Trait Implementations
sourceimpl AccountDeserialize for MergeMiner
impl AccountDeserialize for MergeMiner
sourcefn try_deserialize(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
Deserializes previously initialized account data. Should fail for all
uninitialized accounts, where the bytes are zeroed. Implementations
should be unique to a particular account type so that one can never
successfully deserialize the data of one account type into another.
For example, if the SPL token program were to implement this trait,
it should be impossible to deserialize a Mint
account into a token
Account
. Read more
sourceimpl AccountSerialize for MergeMiner
impl AccountSerialize for MergeMiner
sourceimpl BorshDeserialize for MergeMiner where
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
u8: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
impl BorshDeserialize for MergeMiner where
Pubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
u8: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
u64: BorshDeserialize,
sourceimpl BorshSerialize for MergeMiner where
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
u8: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
impl BorshSerialize for MergeMiner where
Pubkey: BorshSerialize,
Pubkey: BorshSerialize,
u8: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
u64: BorshSerialize,
sourceimpl Clone for MergeMiner
impl Clone for MergeMiner
sourcefn clone(&self) -> MergeMiner
fn clone(&self) -> MergeMiner
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for MergeMiner
impl Debug for MergeMiner
sourceimpl Default for MergeMiner
impl Default for MergeMiner
sourcefn default() -> MergeMiner
fn default() -> MergeMiner
Returns the “default value” for a type. Read more
sourceimpl Discriminator for MergeMiner
impl Discriminator for MergeMiner
fn discriminator() -> [u8; 8]
sourceimpl Owner for MergeMiner
impl Owner for MergeMiner
impl Copy for MergeMiner
Auto Trait Implementations
impl RefUnwindSafe for MergeMiner
impl Send for MergeMiner
impl Sync for MergeMiner
impl Unpin for MergeMiner
impl UnwindSafe for MergeMiner
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more