miden_testing/mock_chain/
fungible_faucet.rs

1use miden_objects::{
2    account::{Account, AccountId},
3    asset::{Asset, FungibleAsset},
4};
5
6// MOCK FUNGIBLE FAUCET
7// ================================================================================================
8
9/// Represents a fungible faucet that exists on the MockChain.
10pub struct MockFungibleFaucet(Account);
11
12impl MockFungibleFaucet {
13    pub(super) fn new(account: Account) -> Self {
14        Self(account)
15    }
16
17    pub fn account(&self) -> &Account {
18        &self.0
19    }
20
21    pub fn id(&self) -> AccountId {
22        self.0.id()
23    }
24
25    pub fn mint(&self, amount: u64) -> Asset {
26        FungibleAsset::new(self.0.id(), amount).unwrap().into()
27    }
28}