Trait kilt_support::traits::StorageDepositCollector
source · pub trait StorageDepositCollector<AccountId, Key, RuntimeHoldReason> {
type Currency: MutateHold<AccountId, Reason = RuntimeHoldReason>;
type Reason: Into<RuntimeHoldReason> + Clone;
// Required methods
fn reason() -> Self::Reason;
fn deposit(
key: &Key
) -> Result<Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>, DispatchError>;
fn deposit_amount(
key: &Key
) -> <Self::Currency as Inspect<AccountId>>::Balance;
fn get_hashed_key(key: &Key) -> Result<Vec<u8>, DispatchError>;
fn store_deposit(
key: &Key,
deposit: Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>
) -> Result<(), DispatchError>;
// Provided methods
fn free_deposit(
deposit: Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>
) -> Result<<Self::Currency as Inspect<AccountId>>::Balance, DispatchError> { ... }
fn create_deposit(
who: AccountId,
amount: <Self::Currency as Inspect<AccountId>>::Balance
) -> Result<Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>, DispatchError> { ... }
fn change_deposit_owner<DepositBalanceMigrationManager>(
key: &Key,
new_owner: AccountId
) -> Result<(), DispatchError>
where DepositBalanceMigrationManager: BalanceMigrationManager<AccountId, <Self::Currency as Inspect<AccountId>>::Balance> { ... }
fn update_deposit<DepositBalanceMigrationManager>(
key: &Key
) -> Result<(), DispatchError>
where DepositBalanceMigrationManager: BalanceMigrationManager<AccountId, <Self::Currency as Inspect<AccountId>>::Balance> { ... }
}
Required Associated Types§
type Currency: MutateHold<AccountId, Reason = RuntimeHoldReason>
type Reason: Into<RuntimeHoldReason> + Clone
Required Methods§
sourcefn reason() -> Self::Reason
fn reason() -> Self::Reason
Returns the hold reason for deposits taken by the deposit collector;
sourcefn deposit(
key: &Key
) -> Result<Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>, DispatchError>
fn deposit( key: &Key ) -> Result<Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>, DispatchError>
Returns the deposit of the storage entry that is stored behind the key.
sourcefn deposit_amount(key: &Key) -> <Self::Currency as Inspect<AccountId>>::Balance
fn deposit_amount(key: &Key) -> <Self::Currency as Inspect<AccountId>>::Balance
Returns the deposit amount that should be reserved for the storage entry behind the key.
This value can differ from the actual deposit that is reserved at the time, since the deposit can be changed.
Provided Methods§
sourcefn free_deposit(
deposit: Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>
) -> Result<<Self::Currency as Inspect<AccountId>>::Balance, DispatchError>
fn free_deposit( deposit: Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance> ) -> Result<<Self::Currency as Inspect<AccountId>>::Balance, DispatchError>
Release the deposit.
sourcefn create_deposit(
who: AccountId,
amount: <Self::Currency as Inspect<AccountId>>::Balance
) -> Result<Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>, DispatchError>
fn create_deposit( who: AccountId, amount: <Self::Currency as Inspect<AccountId>>::Balance ) -> Result<Deposit<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>, DispatchError>
sourcefn change_deposit_owner<DepositBalanceMigrationManager>(
key: &Key,
new_owner: AccountId
) -> Result<(), DispatchError>where
DepositBalanceMigrationManager: BalanceMigrationManager<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>,
fn change_deposit_owner<DepositBalanceMigrationManager>( key: &Key, new_owner: AccountId ) -> Result<(), DispatchError>where DepositBalanceMigrationManager: BalanceMigrationManager<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>,
Change the deposit owner.
The deposit balance of the current owner will be freed, while the deposit balance of the new owner will get reserved. The deposit amount will not change even if the required byte and item fees were updated.
sourcefn update_deposit<DepositBalanceMigrationManager>(
key: &Key
) -> Result<(), DispatchError>where
DepositBalanceMigrationManager: BalanceMigrationManager<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>,
fn update_deposit<DepositBalanceMigrationManager>( key: &Key ) -> Result<(), DispatchError>where DepositBalanceMigrationManager: BalanceMigrationManager<AccountId, <Self::Currency as Inspect<AccountId>>::Balance>,
Update the deposit amount.
In case the required deposit per item and byte changed, this function updates the deposit amount. It either frees parts of the reserved balance in case the deposit was lowered or reserves more balance when the deposit was raised.