pub struct VaultModule { /* private fields */ }Implementations§
Source§impl VaultModule
impl VaultModule
pub fn new() -> Self
pub fn create_vault( &mut self, model_id: Hash32, owner: Address, initial_stake: u128, current_height: u64, ) -> Result<Hash32, RuntimeError>
pub fn stake( &mut self, vault_id: &Hash32, staker: Address, amount: u128, ) -> Result<u128, RuntimeError>
pub fn unstake( &mut self, vault_id: &Hash32, staker: &Address, share_count: u128, ) -> Result<u128, RuntimeError>
pub fn distribute_reward( &mut self, vault_id: &Hash32, reward_amount: u128, ) -> Result<(), RuntimeError>
pub fn claim_rewards( &mut self, vault_id: &Hash32, staker: &Address, ) -> Result<u128, RuntimeError>
pub fn pause_vault(&mut self, vault_id: &Hash32) -> Result<(), RuntimeError>
pub fn resume_vault(&mut self, vault_id: &Hash32) -> Result<(), RuntimeError>
pub fn get_vault(&self, vault_id: &Hash32) -> Option<&Vault>
pub fn all_vaults(&self) -> &HashMap<Hash32, Vault>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VaultModule
impl RefUnwindSafe for VaultModule
impl Send for VaultModule
impl Sync for VaultModule
impl Unpin for VaultModule
impl UnsafeUnpin for VaultModule
impl UnwindSafe for VaultModule
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