pub struct TestQuarry {
pub label: String,
pub quarry: AccountRef<Quarry>,
pub rewarder: Pubkey,
pub staked_token_mint: AccountRef<Mint>,
}Expand description
Test quarry with labeled accounts
Fields§
§label: String§quarry: AccountRef<Quarry>§rewarder: Pubkey§staked_token_mint: AccountRef<Mint>Implementations§
Source§impl TestQuarry
impl TestQuarry
Sourcepub fn fetch_quarry(&self, env: &TestSVM) -> Result<Quarry>
pub fn fetch_quarry(&self, env: &TestSVM) -> Result<Quarry>
Fetch the Quarry account from chain
Sourcepub fn create_miner(
&self,
env: &mut TestSVM,
label: &str,
user: &Keypair,
) -> Result<(AccountRef<Miner>, AccountRef<TokenAccount>)>
pub fn create_miner( &self, env: &mut TestSVM, label: &str, user: &Keypair, ) -> Result<(AccountRef<Miner>, AccountRef<TokenAccount>)>
Create a miner for a user
Sourcepub fn stake_tokens(
&self,
env: &mut TestSVM,
miner: &AccountRef<Miner>,
miner_vault: &AccountRef<TokenAccount>,
user_token_account: &AccountRef<TokenAccount>,
amount: u64,
user: &Keypair,
) -> Result<()>
pub fn stake_tokens( &self, env: &mut TestSVM, miner: &AccountRef<Miner>, miner_vault: &AccountRef<TokenAccount>, user_token_account: &AccountRef<TokenAccount>, amount: u64, user: &Keypair, ) -> Result<()>
Stake tokens into the miner
Sourcepub fn update_quarry_rewards(&self, env: &mut TestSVM) -> Result<()>
pub fn update_quarry_rewards(&self, env: &mut TestSVM) -> Result<()>
Update quarry rewards to reflect time passage
Sourcepub fn withdraw_tokens(
&self,
env: &mut TestSVM,
miner: &AccountRef<Miner>,
miner_vault: &AccountRef<TokenAccount>,
user_token_account: &AccountRef<TokenAccount>,
amount: u64,
user: &Keypair,
) -> Result<()>
pub fn withdraw_tokens( &self, env: &mut TestSVM, miner: &AccountRef<Miner>, miner_vault: &AccountRef<TokenAccount>, user_token_account: &AccountRef<TokenAccount>, amount: u64, user: &Keypair, ) -> Result<()>
Withdraw tokens from the miner
Sourcepub fn claim_rewards(
&self,
env: &mut TestSVM,
rewarder: &TestRewarder,
miner: &AccountRef<Miner>,
_miner_vault: &AccountRef<TokenAccount>,
user_rewards_account: &AccountRef<TokenAccount>,
user: &Keypair,
) -> Result<()>
pub fn claim_rewards( &self, env: &mut TestSVM, rewarder: &TestRewarder, miner: &AccountRef<Miner>, _miner_vault: &AccountRef<TokenAccount>, user_rewards_account: &AccountRef<TokenAccount>, user: &Keypair, ) -> Result<()>
Claim rewards for a miner
Trait Implementations§
Source§impl AsRef<[u8]> for TestQuarry
impl AsRef<[u8]> for TestQuarry
Source§impl Debug for TestQuarry
impl Debug for TestQuarry
Auto Trait Implementations§
impl Freeze for TestQuarry
impl RefUnwindSafe for TestQuarry
impl Send for TestQuarry
impl Sync for TestQuarry
impl Unpin for TestQuarry
impl UnwindSafe for TestQuarry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self into the result. Upper case
letters are used (e.g. F9B4CA)