feat: implement InvoiceContract on Soroban with full invoice lifecycle#88
Open
jerrybarry wants to merge 4 commits intoMetroLogic:mainfrom
Open
feat: implement InvoiceContract on Soroban with full invoice lifecycle#88jerrybarry wants to merge 4 commits intoMetroLogic:mainfrom
jerrybarry wants to merge 4 commits intoMetroLogic:mainfrom
Conversation
|
@jerrybarry Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
5 tasks
…oroban-contract Resolve MetroLogic upstream conflicts by taking upstream sources and snapshots, then wire invoice module and fix multi-contract WASM symbol clashes: - Rename PaymentProcessor::grant_role to payment_grant_role - Rename InvoiceContract getters to invoice_get_admin / invoice_get_payment_processor - Align auth_test and test.rs with Metro merchant initialize and refund grant_role API Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Soroban
InvoiceContractthat stores invoice lifecycle on-chain, prevents double payment viapayment_id, emits events for issued / paid / cancelled transitions, and restrictsmark_paidto the configured Payment Processor address.Closes #39.
Changes
fluxapay/src/invoice.rs—InvoiceContractwithInvoice,InvoiceStatus, storageDataKey, andInvoiceError; entrypoints:invoice_initialize,create_invoice,issue_invoice,mark_paid,cancel_invoice,get_invoice, plusget_admin/get_payment_processorfor tests and integrations.fluxapay/src/lib.rs—pub mod invoice;andRefundManagerstorage fixes (FluxaDataKey) so the crate builds cleanly.create_invoice,issue_invoice/ status errors,mark_paid(includingAlreadyPaid),cancel_invoice, andget_invoice/NotFound.fx_oracle.rsandmerchant_registry.rswhere corrupted code blocked compilation; payment-related tests grant theMERCHANTrole withpayment_grant_rolebeforecreate_paymentwhere required.Design notes
invoice_initialize(notinitialize) — multiple contracts share one WASM artifact; exported names must be unique, consistent withoracle_initialize/merchant_initialize.mark_paid— returnsAlreadyPaidwhenpayment_idis already set (checked before status) so a second settlement maps to double-payment, not a generic invalid status.Verification
cargo test cargo build --target wasm32-unknown-unknown --release cargo clippy --all-targets