Skip to content

feat(contracts): resolve issues #745, #744, #746, and #747 - #962

Merged
Idrhas merged 2 commits into
Farm-credit:mainfrom
utilityjnr:fix/issues-744-745-746-747-contracts
Aug 4, 2026
Merged

feat(contracts): resolve issues #745, #744, #746, and #747#962
Idrhas merged 2 commits into
Farm-credit:mainfrom
utilityjnr:fix/issues-744-745-746-747-contracts

Conversation

@utilityjnr

Copy link
Copy Markdown
Contributor

Detailed summary of implementations across Soroban smart contracts:

  1. Issue [Contract] Implement Batch Minting for Tree-NFT Certificates #745 [Contract] Implement Batch Minting for Tree-NFT Certificates:

    • Added batch_mint to contracts/nft-certificate/src/lib.rs enabling verifiers to mint up to 50 certificates in a single transaction.
    • Enforced batch size limits (max 50, non-empty), input array length equality, pause checks, and individual metadata validation (tree_count > 0, co2_offset_kg > 0).
    • Updated global TOK_COUNT atomically and emitted btch_mnt event. Added corresponding unit tests.
    • Closes [Contract] Implement Batch Minting for Tree-NFT Certificates #745
  2. Issue [Contract] Add Emergency Pause Guard for Soroban Carbon Marketplace #744 [Contract] Add Emergency Pause Guard for Soroban Carbon Marketplace:

    • Added global circuit breaker mechanism (DataKey::Paused) in contracts/carbon-marketplace/src/lib.rs.
    • Added pause, unpause, and is_paused functions gated by admin authorization (admin.require_auth()).
    • Guarded state-changing operations (list, buy, cancel, amm_add_liquidity, amm_remove_liquidity, amm_swap_exact_in, order matching) with assert_not_paused checks. Added corresponding unit tests.
    • Closes [Contract] Add Emergency Pause Guard for Soroban Carbon Marketplace #744
  3. Issue [Contract] Implement Dynamic Fee Tier System in Carbon Dex Swaps #746 [Contract] Implement Dynamic Fee Tier System in Carbon Dex Swaps:

    • Implemented dynamic trade volume-based fee tier calculation (get_fee_bps) in contracts/carbon-marketplace/src/lib.rs: * Tier 1 (< 10,000 units): 30 bps (0.30%) * Tier 2 (10,000 - 100,000 units): 20 bps (0.20%) * Tier 3 (>= 100,000 units): 10 bps (0.10%)
    • Updated amm_swap_exact_in and amm_get_quote to compute DEX swap output and pool fee tracking dynamically based on trade size. Added corresponding unit tests.
    • Closes [Contract] Implement Dynamic Fee Tier System in Carbon Dex Swaps #746
  4. Issue [Contract] Add Slashing Penalty Escalation for Malicious Proof Verifiers #747 [Contract] Add Slashing Penalty Escalation for Malicious Proof Verifiers:

    • Implemented exponential penalty escalation in contracts/verifier-staking/src/lib.rs for repeat offending verifiers.
    • Added OffenseCount tracking (DataKey::OffenseCount), get_offense_count, and slash_escalated function.
    • Calculated penalty multiplier 2^(n-1) where n is the 1-based offense count (capped at 16x), capping effective slash amount at remaining verifier stake.
    • Transferred slashed tokens to the replanting buffer pool and emitted offense escalation events. Added corresponding unit tests.
    • Closes [Contract] Add Slashing Penalty Escalation for Malicious Proof Verifiers #747

Closes #745, #744, #746, #747

Summary

Related Issue

Closes #

What Was Implemented

  • [ ]

Implementation Details

Screenshots / Recordings

How to Test

Checklist

  • My code follows the atomic commit convention
  • Each commit message follows Conventional Commits (feat:, fix:, etc.)
  • I have performed a self-review of my code
  • My changes build successfully (pnpm build)
  • My changes pass linting (pnpm lint)
  • I have added/updated relevant documentation
  • New components follow the atomic design pattern (atoms → molecules → organisms)
  • UI changes are responsive and tested on mobile viewports
  • I have added screenshots/recordings for UI changes

…m-credit#746, and Farm-credit#747

Detailed summary of implementations across Soroban smart contracts:

1. Issue Farm-credit#745 [Contract] Implement Batch Minting for Tree-NFT Certificates:
   - Added batch_mint to contracts/nft-certificate/src/lib.rs enabling verifiers to mint up to 50 certificates in a single transaction.
   - Enforced batch size limits (max 50, non-empty), input array length equality, pause checks, and individual metadata validation (tree_count > 0, co2_offset_kg > 0).
   - Updated global TOK_COUNT atomically and emitted btch_mnt event. Added corresponding unit tests.
   - Closes Farm-credit#745

2. Issue Farm-credit#744 [Contract] Add Emergency Pause Guard for Soroban Carbon Marketplace:
   - Added global circuit breaker mechanism (DataKey::Paused) in contracts/carbon-marketplace/src/lib.rs.
   - Added pause, unpause, and is_paused functions gated by admin authorization (admin.require_auth()).
   - Guarded state-changing operations (list, buy, cancel, amm_add_liquidity, amm_remove_liquidity, amm_swap_exact_in, order matching) with assert_not_paused checks. Added corresponding unit tests.
   - Closes Farm-credit#744

3. Issue Farm-credit#746 [Contract] Implement Dynamic Fee Tier System in Carbon Dex Swaps:
   - Implemented dynamic trade volume-based fee tier calculation (get_fee_bps) in contracts/carbon-marketplace/src/lib.rs:
     * Tier 1 (< 10,000 units): 30 bps (0.30%)
     * Tier 2 (10,000 - 100,000 units): 20 bps (0.20%)
     * Tier 3 (>= 100,000 units): 10 bps (0.10%)
   - Updated amm_swap_exact_in and amm_get_quote to compute DEX swap output and pool fee tracking dynamically based on trade size. Added corresponding unit tests.
   - Closes Farm-credit#746

4. Issue Farm-credit#747 [Contract] Add Slashing Penalty Escalation for Malicious Proof Verifiers:
   - Implemented exponential penalty escalation in contracts/verifier-staking/src/lib.rs for repeat offending verifiers.
   - Added OffenseCount tracking (DataKey::OffenseCount), get_offense_count, and slash_escalated function.
   - Calculated penalty multiplier 2^(n-1) where n is the 1-based offense count (capped at 16x), capping effective slash amount at remaining verifier stake.
   - Transferred slashed tokens to the replanting buffer pool and emitted offense escalation events. Added corresponding unit tests.
   - Closes Farm-credit#747

Closes Farm-credit#745, Farm-credit#744, Farm-credit#746, Farm-credit#747
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@utilityjnr 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! 🚀

Learn more about application limits

@Idrhas
Idrhas merged commit b958223 into Farm-credit:main Aug 4, 2026
3 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants