π¨ ALL CI CHECKS MUST PASS
Your PR will not be reviewed or merged until every CI job is green. No exceptions.
Run all four locally before you push:
cargo fmt --all -- --check # Formatting
cargo clippy --all-targets -- -D warnings # Clippy β warnings are errors
cargo test # Tests
./scripts/build_wasm.sh # Build Optimized WASM
A red build is the single most common reason work stalls on this repo. If CI fails and you are stuck, say so in the PR β do not push a failing build and go quiet.
Also required: put Closes #<this issue number> in your PR description. Without it, GrantFox cannot link your PR to this issue.
What needs to be done
batch_collect_fees calculates fees across a list of escrows, publishes a BatchFeesCollectedEvent stating the total collected, and returns that total β but it never transfers tokens and never updates any stored state. Make it actually move the funds it claims to, and cap how many escrows one call may process.
Why it matters
Any off-chain consumer β indexer, dashboard, accounting β reads that event and records revenue that does not exist. The contract's own return value confirms the false number. On-chain balances and reported earnings drift apart permanently, with no way to reconcile after the fact. The function is also the only fee path that operates in bulk, so the discrepancy compounds.
Technical context
contracts/marketx/src/lib.rs:3656-3721
- The loop computes
fee per escrow with min/max clamping, accumulates total_fees and count, publishes the event, returns the total. There is no transfer and no storage write anywhere in the function.
- Compare with the working single-escrow fee path for the transfer pattern and the pending-fee bookkeeping this should mirror.
escrow_ids: Vec<u64> is unbounded. Existing cap to follow as precedent: MAX_ITEMS_PER_ESCROW (50) in types.rs:145.
Acceptance criteria
Out of scope
- Changing the fee formula or min/max clamping logic
- The single-escrow fee path
- Fee collector permissions
Getting started
cargo test # 120 tests currently pass
cargo clippy --all-targets -- -D warnings
./scripts/build_wasm.sh
Existing fee tests live in src/test.rs β search for test_withdrawal_pattern_for_fees.
What needs to be done
batch_collect_feescalculates fees across a list of escrows, publishes aBatchFeesCollectedEventstating the total collected, and returns that total β but it never transfers tokens and never updates any stored state. Make it actually move the funds it claims to, and cap how many escrows one call may process.Why it matters
Any off-chain consumer β indexer, dashboard, accounting β reads that event and records revenue that does not exist. The contract's own return value confirms the false number. On-chain balances and reported earnings drift apart permanently, with no way to reconcile after the fact. The function is also the only fee path that operates in bulk, so the discrepancy compounds.
Technical context
contracts/marketx/src/lib.rs:3656-3721feeper escrow with min/max clamping, accumulatestotal_feesandcount, publishes the event, returns the total. There is notransferand no storage write anywhere in the function.escrow_ids: Vec<u64>is unbounded. Existing cap to follow as precedent:MAX_ITEMS_PER_ESCROW(50) intypes.rs:145.Acceptance criteria
MAX_ESCROWS_PER_BATCHconstant is defined intypes.rsand enforced, returning a typed error when exceededBatchFeesCollectedEventfires only after a successful transfer, and never on a zero-value callOut of scope
Getting started
Existing fee tests live in
src/test.rsβ search fortest_withdrawal_pattern_for_fees.