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

[Mint] Refactor set_melt_quote_paid #514

Open
callebtc opened this issue Apr 16, 2024 · 0 comments
Open

[Mint] Refactor set_melt_quote_paid #514

callebtc opened this issue Apr 16, 2024 · 0 comments
Labels
code health Code health good first issue A great way to get into Cashu development mint About the Nutshell mint

Comments

@callebtc
Copy link
Collaborator

In various parts of the mint code base, we repeat these steps to set a melt quote as paid. This should be refactored into its own method ledger.set_melt_quote_paid(fee: Optional[Amount] = None) that should be called instead.

Note: set_melt_quote_paid should check if the unit for the fee: Amount argument is the same as quote.unit and error otherwise.

Example code:

quote.paid = True
if payment.fee:
    quote.fee_paid = payment.fee.to(Unit[quote.unit]).amount
quote.proof = payment.preimage or ""
await self.crud.update_melt_quote(quote=quote, db=self.db)
@callebtc callebtc added mint About the Nutshell mint code health Code health good first issue A great way to get into Cashu development labels Apr 16, 2024
cjoshreid added a commit to cjoshreid/nutshell that referenced this issue Apr 18, 2024
issue cashubtc#514 

The _startup_ledger method initializes the ledger and logs backend information.
The _check_pending_proofs_and_melt_quotes method checks pending proofs for their melt state and processes them accordingly.
The log_backend_info, get_pending_melt_quotes, get_pending_proofs, process_quote_payment, set_melt_quote_paid, and get_payment_status methods are helper methods used within the startup routine and quote processing.

This separation of concerns makes the code more modular and easier to maintain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Code health good first issue A great way to get into Cashu development mint About the Nutshell mint
Projects
None yet
Development

No branches or pull requests

1 participant