ArkProjectNFTs / ark-project

ArkProject is a liquidity layer for digital assets, uniting markets, empowering creators, and bridging the gap to mass adoption. Built on top of Starknet, ArkProject is designed to provide a fully decentralized and trustless orderbook on-chain.
https://arkproject.dev
Apache License 2.0
26 stars 12 forks source link

feat(listing): add fulfill listing & tests #184

Closed kwiss closed 9 months ago

kwiss commented 9 months ago

Description

This pull request introduces significant updates to the Orderbook contract, focusing on the implementation of listing order fulfillment and the enhancement of testing scenarios.

Key Additions:

  1. Fulfilling Listing Order Functionality:

    • A new function, fulfill_order, has been added to handle the process of fulfilling orders. This function takes in execution_info and signer as parameters and follows these steps:
      • Verifies the signer.
      • Validates the existence of the order and its status.
      • Checks if the order is open and not fulfilled by the same offerer.
      • Distinguishes the order type and proceeds with the fulfillment process for listing orders.
  2. Private Function for Listing Order Fulfillment:

    • The _fulfill_listing_order private function has been implemented to specifically handle listing orders. It checks the order's expiration date and updates the order status to 'Fulfilled' upon successful execution.
  3. Enhanced Test Coverage:

    • New test scenarios have been added to validate the functionality:
      • test_create_listing_order_and_fulfill_non_existing_order: Ensures the system correctly handles attempts to fulfill non-existing orders.
      • test_create_listing_order_and_fulfill: Tests the successful creation and fulfillment of a listing order.
      • test_create_listing_order_and_fulfill_with_same_fulfiller: Validates that an order cannot be fulfilled by the same entity that created it.

These updates aim to streamline the order fulfillment process, particularly for listing orders, while ensuring robustness through comprehensive testing.

What type of PR is this? (check all applicable)

Related Tickets & Documents

Added tests?

Added to documentation?

[optional] Are there any post-deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

PR Title and Description Guidelines:

Closing Issues