Struct forest_actor::util::BalanceTable
source · [−]pub struct BalanceTable<'a, BS>(_);
Expand description
Balance table which handles getting and updating token balances specifically
Implementations
Initializes a balance table from a root Cid
Gets token amount for given address in balance table
Adds token amount to previously initialized account.
pub fn subtract_with_minimum(
&mut self,
key: &Address,
req: &TokenAmount,
floor: &TokenAmount
) -> Result<TokenAmount, Box<dyn StdError>>
pub fn subtract_with_minimum(
&mut self,
key: &Address,
req: &TokenAmount,
floor: &TokenAmount
) -> Result<TokenAmount, Box<dyn StdError>>
Subtracts up to the specified amount from a balance, without reducing the balance below some minimum. Returns the amount subtracted (always positive or zero).
pub fn must_subtract(
&mut self,
key: &Address,
req: &TokenAmount
) -> Result<(), Box<dyn StdError>>
pub fn must_subtract(
&mut self,
key: &Address,
req: &TokenAmount
) -> Result<(), Box<dyn StdError>>
Subtracts value from a balance, and errors if full amount was not substracted.