Skip to content

feat(auction): add Dutch auction mechanism for fractional share sales#536

Merged
nanaf6203-bit merged 4 commits into
MettaChain:mainfrom
Nanfe01:auc
Jun 2, 2026
Merged

feat(auction): add Dutch auction mechanism for fractional share sales#536
nanaf6203-bit merged 4 commits into
MettaChain:mainfrom
Nanfe01:auc

Conversation

@Nanfe01
Copy link
Copy Markdown
Contributor

@Nanfe01 Nanfe01 commented Jun 2, 2026

Summary

Introduced a Dutch auction system for fractional share sales, enabling time-based price discovery where asset prices decrease linearly until a buyer accepts the current price.

Changes Made

  • Added DutchAuction struct containing:

    • token_id
    • shares
    • start_price
    • end_price
    • start_time
    • duration
  • Implemented create_dutch_auction(token_id, shares, start_price, end_price, duration) message

  • Implemented bid_dutch_auction(auction_id) message allowing buyers to purchase at the current descending price

  • Implemented cancel_dutch_auction(auction_id) message (restricted to seller before first bid)

  • Added linear price decay formula:

    • current_price = start_price - (elapsed / duration) * (start_price - end_price)
  • Auction lifecycle management:

    • Auction completes immediately on first valid bid
    • Remaining shares (if applicable) returned to seller
  • Added event emissions:

    • DutchAuctionCreated
    • DutchAuctionBid
    • DutchAuctionCancelled
  • Added full unit test coverage for:

    • Auction creation
    • Price decay calculation over time
    • Successful bid execution and auction completion
    • Cancellation before first bid
    • Edge cases across auction states

Auction Behavior

  • Price decreases linearly from start_price to end_price over the auction duration
  • First successful bid immediately finalizes the auction
  • Unsold shares are returned to seller after execution
  • Cancellation is only allowed before any bids are placed

Acceptance Criteria

  • Add DutchAuction struct
  • Add create_dutch_auction(...) message
  • Add bid_dutch_auction(...) message
  • Implement descending price formula based on elapsed time
  • Complete auction on first bid
  • Return remaining shares to seller
  • Add cancel_dutch_auction(...) message (seller only, pre-bid)
  • Emit required events
  • Add unit tests for full auction lifecycle

closes #498

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 2, 2026

@Nanfe01 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

Copy link
Copy Markdown
Contributor

@nanaf6203-bit nanaf6203-bit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nanaf6203-bit nanaf6203-bit merged commit c173271 into MettaChain:main Jun 2, 2026
1 of 14 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

Development

Successfully merging this pull request may close these issues.

feat: Implement Dutch auction mechanism for fractional share sales

2 participants