Skip to content

Feat/issues 1043 1044 1045 1046 - #1170

Merged
Ehonrie merged 3 commits into
Netwalls:mainfrom
aladi11isah:feat/issues-1043-1044-1045-1046
Jul 28, 2026
Merged

Feat/issues 1043 1044 1045 1046#1170
Ehonrie merged 3 commits into
Netwalls:mainfrom
aladi11isah:feat/issues-1043-1044-1045-1046

Conversation

@aladi11isah

Copy link
Copy Markdown
Contributor

Summary

Implements protocol fee rate management in Treasury contract and ensures market creation events are properly emitted for indexer compatibility.

Changes

Treasury Contract (Issue #1043, #1044, #1045)

  • set_fee_bps: Admin-only method to update protocol fee rate with ceiling validation (max 10000 basis points)
  • get_balance: Read-only method returning current treasury escrow balance
  • withdraw_fees: Admin-only method to sweep accrued fees to recipient, logs withdrawals, returns amount withdrawn
  • Cleaned up ~400 lines of duplicate code
  • Added storage key for fee rate (FEE_BPS)

Market Contract (Issue #1046)

  • Emit market_created event in Market::initialize with:
    • Topics: (Symbol("market_created"), market_id)
    • Data: Full Market struct for indexer compatibility
  • Fixed Market struct initialization (removed duplicate outcome field)

Documentation

  • Added contracts/README.md with:
    • Event reference table with topics and data payloads
    • Storage key mappings for all contracts
    • Error handling and type definitions

Testing

  • 6 unit tests covering success paths and error conditions
  • Authorization and validation tested
  • Edge cases handled (ceiling exceeded, double initialization, unauthorized access)

Closes #1043
Closes #1044
Closes #1045
Closes #1046

aladi11isah and others added 3 commits July 28, 2026 07:58
… fix withdraw_fees return value

- Issue 1043: Add set_fee_bps method (admin-only, rejects values > 10000 basis points)
- Issue 1044: Ensure get_balance returns correct escrow balance for market/token pair
- Issue 1045: Update withdraw_fees to return amount withdrawn and restrict to admin only
- Remove duplicate method definitions and clean up storage key management
- Add proper event emissions for fee updates and withdrawals
- Issue 1046: Emit market_created event in Market::initialize
- Event topics: (Symbol('market_created'), market_id)
- Event data: Full Market struct (matches MarketInfo field-for-field)
- Document event structure and topics in contracts/README.md
- Fix Market struct initialization to remove duplicate outcome field
- Ensure indexer can decode event without ambiguity
@Ehonrie
Ehonrie merged commit 834d9f0 into Netwalls:main Jul 28, 2026
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