Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DEX orders on stellar client #119

Open
wants to merge 19 commits into
base: development
Choose a base branch
from

Conversation

AlaaElattar
Copy link
Contributor

@AlaaElattar AlaaElattar commented Dec 5, 2024

Description

  • support placing, canceling, and listing orders

Changes

  • Added createOrder, user can create buy/sell orders for specific assets.
  • Added cancelOrder, user can cancel specific order with its id.
  • Added getOrderBook, user can get oder book of the conversion between any 2 assets.
  • Added listMyOffers, user can list its offers.
  • Added updateOrder, user can update an existing offer with its id.

Related Issues

#112

Checklist

  • Tests included
  • Build pass
  • Code format
  • Screenshots/Video attached (needed for UI changes)

@AlaaElattar AlaaElattar marked this pull request as draft December 5, 2024 10:56
@AlaaElattar AlaaElattar marked this pull request as ready for review December 22, 2024 15:32
Copy link
Collaborator

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

Please fix analyze workflow. Also, can you replace prints with logger?

@AlaaElattar AlaaElattar marked this pull request as draft December 25, 2024 07:57
@AlaaElattar AlaaElattar marked this pull request as ready for review December 25, 2024 08:53
Copy link
Collaborator

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

I get insufficient balance although I have enough XLMs in my balance.

image

Also, USDC asset code is not added while adding trustline,

Logger is not working. I had to edit the logger value in client to the following for it to print.

  var logger = Logger(
    printer: PrettyPrinter(
      methodCount: 2,
      errorMethodCount: 8,
      lineLength: 120,
      colors: true,
      printEmojis: true,
    ),
    level: Level.debug,
    filter: ProductionFilter(),
  );

@AlaaElattar AlaaElattar marked this pull request as draft January 9, 2025 15:33
@AlaaElattar AlaaElattar marked this pull request as ready for review January 12, 2025 13:57
Copy link
Collaborator

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

Although I create an order successfully, I get an empty list when listing offers.

image

@zaelgohary
Copy link
Collaborator

I get the following error while updating the order.

image

@AlaaElattar
Copy link
Contributor Author

AlaaElattar commented Jan 14, 2025

Although I create an order successfully, I get an empty list when listing offers.

image

  • I tried the same behavior and the balance changed.
    Screenshot 2025-01-14 at 12 37 02 PM

@AlaaElattar
Copy link
Contributor Author

I get the following error while updating the order.

image

  • The offers list is empty which means the order already done.
  • That's why its not found when updating it in the offers.

Copy link
Collaborator

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

  • Can we add Docs to the PR? Please, don't forget to handle the units we use in creating/updating orders.

image

  • When creating order with price '.0001; I get the following err: (It leads the leading 0. Needs to be mentioned in the docs)

image

  • When creating account through threefold service on Testnet, it failed to add USDC asset.

image

  • Amount before and after create order does not match the price

image

  • I created 4 offers, none of them were listed in the orderbook
    image

@AlaaElattar AlaaElattar marked this pull request as draft February 9, 2025 12:40
@AlaaElattar AlaaElattar marked this pull request as ready for review February 10, 2025 10:28
Copy link
Collaborator

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

  • Orderbook is not being updated with my offers. It lists only 6 offers. (Maybe it's paginated? idk.).

  • I think the getOrderBook docs equation is incorrect.
    image

@AlaaElattar
Copy link
Contributor Author

  • Orderbook is not being updated with my offers. It lists only 6 offers. (Maybe it's paginated? idk.).
  • I think the getOrderBook docs equation is incorrect.
    image
  • I check the representation again and what i noticed about stellar representation is :
Total selling amount = Buy amount * price
price = 1 / price

@AlaaElattar
Copy link
Contributor Author

  • Orderbook is not being updated with my offers. It lists only 6 offers. (Maybe it's paginated? idk.).
  • I think the getOrderBook docs equation is incorrect.
    image
  • About the first point of order book, I found that it doesn't support traditional pagination.
  • It returns a snapshot of the current order book state. (only limited number of bids and asks)

Copy link
Collaborator

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

Good job, @AlaaElattar!

@AlaaElattar AlaaElattar marked this pull request as draft March 10, 2025 22:13
@AlaaElattar AlaaElattar marked this pull request as ready for review March 10, 2025 22:23
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.

2 participants