pub trait AccountManager<Account, Balance, Hash, BlockNumber, AssetId> {
Show 16 methods
// Required methods
fn get_charge_or_fail(
charge_id: Hash
) -> Result<RequestCharge<Account, Balance, AssetId>, DispatchError>;
fn no_charge_or_fail(charge_id: Hash) -> Result<(), DispatchError>;
fn get_settlement(
charge_id: Hash
) -> Option<Settlement<Account, Balance, AssetId>>;
fn get_settlements_by_role(
role: CircuitRole
) -> Vec<(Account, Settlement<Account, Balance, AssetId>)>;
fn bump_contracts_registry_nonce() -> Result<Hash, DispatchError>;
fn validate_deposit(
charge_id: Hash,
request_charge: RequestCharge<Account, Balance, AssetId>
) -> Result<Balance, DispatchError>;
fn deposit_batch(
batch: &[(Hash, RequestCharge<Account, Balance, AssetId>)]
) -> DispatchResult;
fn deposit(
charge_id: Hash,
request_charge: RequestCharge<Account, Balance, AssetId>
) -> DispatchResult;
fn finalize(
charge_id: Hash,
outcome: Outcome,
maybe_recipient: Option<Account>,
maybe_actual_fees: Option<Balance>
) -> DispatchResult;
fn finalize_infallible(charge_id: Hash, outcome: Outcome) -> bool;
fn cancel_deposit(charge_id: Hash) -> bool;
fn assign_deposit(charge_id: Hash, recipient: &Account) -> bool;
fn transfer_deposit(
charge_id: Hash,
new_charge_id: Hash,
new_reward: Option<Balance>,
new_payee: Option<&Account>,
new_recipient: Option<&Account>
) -> DispatchResult;
fn can_withdraw(
beneficiary: &Account,
amount: Balance,
asset_id: Option<AssetId>
) -> bool;
fn deposit_immediately(
beneficiary: &Account,
amount: Balance,
asset_id: Option<AssetId>
);
fn withdraw_immediately(
beneficiary: &Account,
amount: Balance,
asset_id: Option<AssetId>
) -> DispatchResult;
}
Required Methods§
sourcefn get_charge_or_fail(
charge_id: Hash
) -> Result<RequestCharge<Account, Balance, AssetId>, DispatchError>
fn get_charge_or_fail( charge_id: Hash ) -> Result<RequestCharge<Account, Balance, AssetId>, DispatchError>
Lookup charge by Id and fail if not found
sourcefn no_charge_or_fail(charge_id: Hash) -> Result<(), DispatchError>
fn no_charge_or_fail(charge_id: Hash) -> Result<(), DispatchError>
Lookup charge by Id and fail if not found
sourcefn get_settlement(
charge_id: Hash
) -> Option<Settlement<Account, Balance, AssetId>>
fn get_settlement( charge_id: Hash ) -> Option<Settlement<Account, Balance, AssetId>>
Lookup charge by Id and fail if not found
sourcefn get_settlements_by_role(
role: CircuitRole
) -> Vec<(Account, Settlement<Account, Balance, AssetId>)>
fn get_settlements_by_role( role: CircuitRole ) -> Vec<(Account, Settlement<Account, Balance, AssetId>)>
Get all settlements by role in the current round
sourcefn bump_contracts_registry_nonce() -> Result<Hash, DispatchError>
fn bump_contracts_registry_nonce() -> Result<Hash, DispatchError>
Bump contracts registry nonce in Account Manager nonce state and return charge request Id
sourcefn validate_deposit(
charge_id: Hash,
request_charge: RequestCharge<Account, Balance, AssetId>
) -> Result<Balance, DispatchError>
fn validate_deposit( charge_id: Hash, request_charge: RequestCharge<Account, Balance, AssetId> ) -> Result<Balance, DispatchError>
Validate deposit goes through
sourcefn deposit_batch(
batch: &[(Hash, RequestCharge<Account, Balance, AssetId>)]
) -> DispatchResult
fn deposit_batch( batch: &[(Hash, RequestCharge<Account, Balance, AssetId>)] ) -> DispatchResult
Send batch deposits to a recipient via the escrow
sourcefn deposit(
charge_id: Hash,
request_charge: RequestCharge<Account, Balance, AssetId>
) -> DispatchResult
fn deposit( charge_id: Hash, request_charge: RequestCharge<Account, Balance, AssetId> ) -> DispatchResult
Send funds to a recipient via the escrow
sourcefn finalize(
charge_id: Hash,
outcome: Outcome,
maybe_recipient: Option<Account>,
maybe_actual_fees: Option<Balance>
) -> DispatchResult
fn finalize( charge_id: Hash, outcome: Outcome, maybe_recipient: Option<Account>, maybe_actual_fees: Option<Balance> ) -> DispatchResult
Finalize a transaction, with an optional reason for failures
sourcefn finalize_infallible(charge_id: Hash, outcome: Outcome) -> bool
fn finalize_infallible(charge_id: Hash, outcome: Outcome) -> bool
Assert infallible finalize of a transaction if exists