Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Payments] - Add Disputes and Request Payment functionalities (with Polkadot-SDK Virto fork) #320

Merged
merged 31 commits into from
Nov 8, 2023

Conversation

darkforest0202
Copy link
Contributor

@darkforest0202 darkforest0202 commented Nov 7, 2023

This PR completes the initial implementation of the task Pallet payments refactor.

Particularly, this is adding:

Phase 2: Request payment

B agrees to sell a product to A, and B sends an "invoice" that needs to be pay by A (no balance held)
A accept the request by calling accept_and_pay.

Calls:
request_payment
accept_and_pay

Phase 4: Disputes

Phase 4: Disputes

Disputes over a discrepancy over a payment. A buys from B, so B start the dispute.

Agreement in the refund

  1. B calls request_refund.
  2. A agree and does not dispute, so when timestamp is reached automatically the balance are refunded.

Not agreement path

  1. B calls request_refund.
  2. A does not agree so executes dispute_refund.
  3. Judge resolves the dispute by calling resolve_payment.

Judge can be dynamic by implementing DisputeResolver trait.

Disclaimer: This PR is lacking some important tasks that will be added in future PRs such as:

Set benchmarking for all pallet-payments #306
Optimization. #307
Add inline doc. #308
Configure pallet-payments in the Kreivo Runtime. #309

@darkforest0202 darkforest0202 requested a review from olanod November 7, 2023 13:42
Copy link
Member

@olanod olanod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made cosmetic changes to reduce nesting, cloning, branching and some naming updates.

@olanod olanod merged commit 7b8f771 into master Nov 8, 2023
1 check passed
@olanod olanod deleted the feat-add-disputes-payment-pallet branch November 8, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants