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

Payment service: allow receiving funds without account init #845

Merged
merged 3 commits into from
Dec 7, 2020

Conversation

Wiezzel
Copy link

@Wiezzel Wiezzel commented Dec 3, 2020

Driver registration separated from account registration. Receiving funds and checking account status made possible without prior initialization.


Testing instructions:

  1. Run payment_api with a custom provider address.
$ cargo run --example payment_api -- --driver=zksync --provider-addr=0x5b663b55D1D0A2703922713C20CBf14508d18819
  1. Run invoice_flow to trigger a payment and look for errors.
$ cargo run --example invoice_flow
    Finished dev [unoptimized + debuginfo] target(s) in 0.28s
     Running `/home/adam/yagna/target/debug/examples/invoice_flow`
[2020-12-07T12:44:18Z INFO  invoice_flow] Issuing invoice...
[2020-12-07T12:44:18Z INFO  invoice_flow] Invoice issued.
[2020-12-07T12:44:18Z INFO  invoice_flow] Sending invoice...
[2020-12-07T12:44:18Z INFO  invoice_flow] Invoice sent.
[2020-12-07T12:44:18Z INFO  invoice_flow] Creating allocation...
[2020-12-07T12:44:18Z INFO  invoice_flow] Allocation created.
[2020-12-07T12:44:18Z INFO  invoice_flow] Accepting invoice...
[2020-12-07T12:44:18Z INFO  invoice_flow] Invoice accepted.
[2020-12-07T12:44:18Z INFO  invoice_flow] Waiting for payment...
[2020-12-07T12:44:50Z INFO  invoice_flow] Payment verified correctly.
[2020-12-07T12:44:50Z INFO  invoice_flow] Verifying invoice status...
[2020-12-07T12:44:50Z INFO  invoice_flow] Invoice status verified correctly.
  1. Check account status.
$ cargo run payment status 0x5b663b55D1D0A2703922713C20CBf14508d18819
---
amount: "1.23002852"
incoming:
  accepted:
    agreementsCount: 1
    totalAmount: "1.230028519070000"
  confirmed:
    agreementsCount: 1
    totalAmount: "1.230028519070000"
  requested:
    agreementsCount: 1
    totalAmount: "1.230028519070000"
...

@Wiezzel Wiezzel requested a review from maaktweluit December 3, 2020 15:59
Driver registration separated from account registration. This is a
prerequisite for implementing payment verification without account
initialization.

Signed-off-by: Adam Wierzbicki <[email protected]>
@Wiezzel Wiezzel force-pushed the wiezzel/custom_recv_addr branch from 85a7efc to 609da3b Compare December 3, 2020 15:59
@Wiezzel Wiezzel changed the title Payment service: driver registration Payment service: allow receiving funds without account init Dec 3, 2020
@Wiezzel Wiezzel marked this pull request as ready for review December 3, 2020 16:34
@Wiezzel Wiezzel requested a review from a team December 3, 2020 16:34
Payment drivers need to be initialized *after* the payment service.
Otherwise, calling `RegisterDriver` would be impossible.

Signed-off-by: Adam Wierzbicki <[email protected]>
Copy link
Contributor

@maaktweluit maaktweluit left a comment

Choose a reason for hiding this comment

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

LGTM!

Tested OK 🍏

@Wiezzel Wiezzel merged commit 60ecce9 into master Dec 7, 2020
@Wiezzel Wiezzel deleted the wiezzel/custom_recv_addr branch December 7, 2020 13:56
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