Payout draft - #433
Open
elRaulito wants to merge 2 commits into
Open
Conversation
New file: validators/payout.ak
The payout accumulator contract with two validators:
mint — MintPayout couples to InitializePayout in withdrawal.ak (exactly 1 NFT minted, asset name = burnt withdrawal NFT). BurnPayout couples to ConcludeWithdrawal (NFT only burnable when fully funded).
spend — AddFunds collects one reserve UTxO at a time, enforces monotonic accumulation, same address in/out (prevents theft), NoDatum invariant, excess returns to reserve_addr. ConcludeWithdrawal recovers payout params from settlement Merkle tree via withdrawal_out_ref + proof (no datum needed), checks fully funded, releases exactly l2_value to l1_address.
Modified: lib/midgard/payout.ak
Removed Datum type (NoDatum design — no datum injection attack possible)
SpendRedeemer → proper sum type with all needed indices for AddFunds and ConcludeWithdrawal
MintRedeemer → proper sum type with MintPayout and BurnPayout variants
Modified: validators/user-events/withdrawal.ak
InitializePayout: replaced InlineDatum(payout.Datum { .. }) check with NoDatum — payout UTxOs start empty
Updated payout.MintRedeemer { .. } pattern to payout.MintPayout { .. } (new sum type)
Discarded unused withdrawal_body binding
Pre-existing bugs fixed (unrelated to payout):
validators/scheduler.ak — labeled args before <- continuation in one_to_one call
validators/settlement.ak (×2) — same issue
validators/operator-directory/active-operators.ak — same issue in spend_for_updating_elements_data
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.
As our last conversation with @keyan-m , this is the draft of the payout contract to fix the issues that were open about it
Please let me know once you review and any change you need to it
Raul