Crates.io | orml-payments |
lib.rs | orml-payments |
version | 1.0.0 |
source | src |
created_at | 2022-11-22 13:24:07.207454 |
updated_at | 2024-08-01 02:01:45.219427 |
description | Allows users to post escrow payment on-chain |
homepage | https://github.com/virto-network/virto-node |
repository | https://github.com/virto-network/virto-node |
max_upload_size | |
id | 720814 |
size | 87,775 |
This pallet allows users to create secure reversible payments that keep funds locked in a merchant's account until the off-chain goods are confirmed to be received. Each payment gets assigned its own judge that can help resolve any disputes between the two parties.
PaymentCreated { from: T::AccountId, asset: AssetIdOf<T>, amount: BalanceOf<T> },
,PaymentReleased { from: T::AccountId, to: T::AccountId }
,PaymentCancelled { from: T::AccountId, to: T::AccountId }
,PaymentCreatorRequestedRefund { from: T::AccountId, to: T::AccountId, expiry: BlockNumberFor<T>}
PaymentRefundDisputed { from: T::AccountId, to: T::AccountId }
PaymentRequestCreated { from: T::AccountId, to: T::AccountId }
PaymentRequestCompleted { from: T::AccountId, to: T::AccountId }
pay
- Create an payment for the given currencyid/amountpay_with_remark
- Create a payment with a remark, can be used to tag paymentsrelease
- Release the payment amount to recipentcancel
- Allows the recipient to cancel the payment and release the payment amount to creatorresolve_release_payment
- Allows assigned judge to release a paymentresolve_cancel_payment
- Allows assigned judge to cancel a paymentrequest_refund
- Allows the creator of the payment to trigger cancel with a buffer time.claim_refund
- Allows the creator to claim payment refund after buffer timedispute_refund
- Allows the recipient to dispute the payment request of senderrequest_payment
- Create a payment that can be completed by the sender using the accept_and_pay
extrinsic.accept_and_pay
- Allows the sender to fulfill a payment request created by a recipientThe RatesProvider module provides implementations for the following traits.
The PaymentDetail
struct stores information about the payment/escrow. A "payment" in virto network is similar to an escrow, it is used to guarantee proof of funds and can be released once an agreed upon condition has reached between the payment creator and recipient. The payment lifecycle is tracked using the state field.
pub struct PaymentDetail<T: pallet::Config> {
/// type of asset used for payment
pub asset: AssetIdOf<T>,
/// amount of asset used for payment
pub amount: BalanceOf<T>,
/// incentive amount that is credited to creator for resolving
pub incentive_amount: BalanceOf<T>,
/// enum to track payment lifecycle [Created, NeedsReview]
pub state: PaymentState<BlockNumberFor<T>>,
/// account that can settle any disputes created in the payment
pub resolver_account: T::AccountId,
/// fee charged and recipient account details
pub fee_detail: Option<(T::AccountId, BalanceOf<T>)>,
/// remarks to give context to payment
pub remark: Option<BoundedDataOf<T>>,
}
The PaymentState
enum tracks the possible states that a payment can be in. When a payment is 'completed' or 'cancelled' it is removed from storage and hence not tracked by a state.
pub enum PaymentState<BlockNumber> {
/// Amounts have been reserved and waiting for release/cancel
Created,
/// A judge needs to review and release manually
NeedsReview,
/// The user has requested refund and will be processed by `BlockNumber`
RefundRequested(BlockNumber),
}
The rates_provider pallet does not depend on the GenesisConfig
License: Apache-2.0