Skip to content

feat(treasury): implement deposit, collect_fee, release_winnings, and… - #1169

Merged
Ehonrie merged 2 commits into
Netwalls:mainfrom
emekaabraham666:feat/1039-1040-1041-1042-treasury-functions
Jul 28, 2026
Merged

Ehonrie merged 2 commits into
Netwalls:mainfrom
emekaabraham666:feat/1039-1040-1041-1042-treasury-functions

Conversation

@emekaabraham666

Copy link
Copy Markdown
Contributor

Treasury Contract: Implement Escrow Management Functions

Implement core Treasury functions for managing bet escrows and protocol fee distribution in prediction markets.

Changes

  • deposit: Pull bet tokens into per-market escrow from Market contracts
  • collect_fee: Compute protocol fee from gross payouts using basis points
  • release_winnings: Release winnings to claimants net of protocol fee from escrow
  • refund: Return full original stake without fees for cancelled markets

All functions include authorization checks against MarketFactory, per-market escrow tracking, event emission, and comprehensive error handling.

Tests

  • Unit tests for each function covering happy paths and error conditions
  • Fee calculation tests at multiple basis point rates (100bp, 200bp, 500bp)
  • Authorization and escrow validation tests

Closes #1039
Closes #1040
Closes #1041
Closes #1042

emekaabraham666 and others added 2 commits July 28, 2026 07:58
… refund functions

Implement 4 core Treasury functions for managing bet escrows and payouts:
- deposit (Issue Netwalls#1039): Pull bet tokens into per-market escrow
- collect_fee (Issue Netwalls#1041): Compute protocol fee from gross payout
- release_winnings (Issue Netwalls#1040): Release winnings to claimant net of fee
- refund (Issue Netwalls#1042): Return full stake for cancelled markets

All functions include:
- Proper authorization checks against MarketFactory
- Per-market escrow tracking
- Event emission
- Comprehensive error handling
- Unit tests for each function
@Ehonrie
Ehonrie merged commit 5287c38 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