feat: implement transfer hook lock, admin clawback, and dynamic penal… - #257
Merged
chizzy192 merged 1 commit intoJul 30, 2026
Merged
Conversation
|
@sudo-robi 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! 🚀 |
Contributor
|
Hi @sudo-robi, your PR modifies 74 files including test snapshot JSONs. Please execute an interactive rebase against dev ( |
sudo-robi
force-pushed
the
feature/issue-implementation
branch
from
July 30, 2026 16:09
e7fc49b to
5ffffec
Compare
- Re-add feature error variants (InvalidPenaltyConfig, InvalidPaymentToken, InvalidInvoiceToken, IdenticalTokens) lost during rebase - Add EscrowFunded check in cancel_escrow before generic CancelNotAllowed - Remove erroneous EscrowPartiallyFunded guard that blocked partial refunds - Fix test_two_token_escrow_different_tokens broken assertion syntax - Fix test_cancel_escrow_already_funded_rejected expected error - Split merged test_cancel_escrow_partially_funded_refunds/rejected into two proper functions - Fix test_settlement_at_exact_due_date_state_persistence purchase_price to match amount for seller distribution
sudo-robi
force-pushed
the
feature/issue-implementation
branch
from
July 30, 2026 16:43
5ffffec to
39e7d88
Compare
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.
closes #96
closes #97
closes #88
Description
Implements three contract features across invoice-token and invoice-escrow:
clawbackfunction to burn tokens from holder's balanceclawbackfunction enables recovery of fraudulent/misissued tokensAlso fixed a pre-existing bug in payment-distributor where
distribute_paymentincorrectly tried to pay the seller (already paid by escrow).Type of Change
Changes
invoice-token (
contracts/invoice-token/)clawback(from: Address, amount: i128, by: Address)- admin-only burn from holderClawbackNotAllowed = 12error variantclawback_eventemissioninvoice-escrow (
contracts/invoice-escrow/)penalty_base_bps(default 100 = 1%) andpenalty_rate_per_day_bps(default 10 = 0.1%/day) to Configcalculate_penalty(invoice_id)- dynamic rate =base + rate_per_day * days_overdue, capped at 10000 bps (100%), applied to remaining face valueset_penalty_config(base_bps, rate_per_day_bps)admin functionpenalty_calculated_eventandpenalty_config_updated_eventcreate_escrownow checks paused statefunder_opt.into_val(&env)→funder_opt.unwrap_or(config.admin.clone())payment-distributor (
contracts/payment-distributor/)distribute_paymentto only distribute to funder (investor_amount) and admin (platform_fee) - seller already receives purchase_price from escrow directlyTesting
cargo fmt --all✅cargo clippy --all-targets --all-features -- -D warnings✅How to Test