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

Feat/dexalot #9

Closed
wants to merge 40 commits into from
Closed

Feat/dexalot #9

wants to merge 40 commits into from

Conversation

vic-en
Copy link

@vic-en vic-en commented Mar 10, 2023

Before submitting this PR, please make sure:

  • Your code builds clean without any errors or warnings
  • You are using approved title ("feat/", "fix/", "docs/", "refactor/")

A description of the changes proposed in the pull request:
This is the main pr for Dexalot gateway. The functionality of this connector can be accessed through the endpoints on the club routes combined with the endpoints on the network routes.

Hence, the qa should test the following endpoints:

/network/balances
/network/poll
/clob/markets
/clob/orderBook
/clob/ticker
[GET] /clob/orders
[POST] /clob/orders
[DELETE] /clob/orders
/clob/batchOrders
/clob/estimateGas

Notes for QA
The flow from creation to cancellation of orders is as follows:

  • Create orders by making request to the [POST] /clob/orders or /clob/batchOrders with the createOrderParams. You will get a response similar to the one below
    Screenshot 2023-03-10 at 1 50 45 AM
  • Poll for the status of the transaction using the txHash in the response to know the status of the creation transaction.
  • Once the transaction is confirmed, make a request to [GET] /clob/orders using your public key address and the ClientOrderId returned in the response to create orders. By doing this, you'll be able to see the id (i.e. exchangeOrderId)
  • The id(i.e. exchangeOrderId) can then be supplied as the id to any of the cancellation endpoint to cancel the order.

@rxlxrxsx
Copy link

Copy link

@rxlxrxsx rxlxrxsx left a comment

Choose a reason for hiding this comment

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

Tested and confirmed working by QA.

  • Successfully cloned and installed branch
  • Setup and run gateway, no issues found
  • Export needed variables and run endpoints for network and clob routes and confirmed working

rapcmia and others added 2 commits March 13, 2023 22:53
@geneuinely07
Copy link
Collaborator

[ch-37162]

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #37162: Create Dexalot Connector in Gateway.

Copy link

@CrimsonJacket CrimsonJacket left a comment

Choose a reason for hiding this comment

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

Requested some minor changes. Rest LGTM.

Comment on lines 20 to 32
export const OrderType1 = {
MARKET: 0,
LIMIT: 1,
STOP: 2, // not used
STOPLIMIT: 3, // not used
};

export const OrderType2 = {
GTC: 0, // Good Till Cancel,
FOK: 1, // Fill or Kill - requires immediate full fill or reverts
IOC: 2, // Immediate or Cancel - gets any fills & then canceled Remaining will not go in the orderbook
PO: 3, // Post Only - Requires to go in the orderbook without any fills or reverts
};

Choose a reason for hiding this comment

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

Is there a better description for these 2 order types? i.e.
OrderType to determine between LIMIT, MARKET, etc
AdditionalOrderOptions to determine GTC, PO, etc

Copy link
Author

Choose a reason for hiding this comment

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

done
I used TimeInForce instead of AdditionalOrderOptions

Comment on lines 42 to 63
export const parseMarkerInfo = (marketInfo: MarketInfoStruct) => {
return {
baseSymbol: toUtf8(marketInfo.baseSymbol),
quoteSymbol: toUtf8(marketInfo.quoteSymbol),
buyBookId: toUtf8(marketInfo.buyBookId),
sellBookId: toUtf8(marketInfo.sellBookId),
minTradeAmount: marketInfo.minTradeAmount.toString(),
maxTradeAmount: marketInfo.maxTradeAmount.toString(),
auctionPrice: marketInfo.auctionPrice.toString(),
auctionMode: marketInfo.auctionMode,
makerRate: marketInfo.makerRate / 10000, // https://github.com/Dexalot/contracts/blob/1ec4b732b06dd2a25fe666cfde5b619af5b6f20b/contracts/TradePairs.sol#L43
takerRate: marketInfo.takerRate / 10000, // https://github.com/Dexalot/contracts/blob/1ec4b732b06dd2a25fe666cfde5b619af5b6f20b/contracts/TradePairs.sol#L43
baseDecimals: marketInfo.baseDecimals,
baseDisplayDecimals: marketInfo.baseDisplayDecimals,
quoteDecimals: marketInfo.quoteDecimals,
quoteDisplayDecimals: marketInfo.quoteDisplayDecimals,
allowedSlippagePercent: marketInfo.allowedSlippagePercent,
addOrderPaused: marketInfo.addOrderPaused,
pairPaused: marketInfo.pairPaused,
postOnly: marketInfo.postOnly,
};
};

Choose a reason for hiding this comment

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

I would classify this function and those defined below to be util functions and thus it should not be found in a constants file.

Copy link
Author

Choose a reason for hiding this comment

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

done

Comment on lines 64 to 68
// this._exchangeContract = this.getContract('ExchangeSub', this._resources);
this._portfolioContract = this.getContract('PortfolioSub', this._resources);
// this._orderBooksContract = this.getContract('OrderBooks', this._resources);
this._tradePairsContract = this.getContract('TradePairs', this._resources);
// this._gasStationContract = this.getContract('GasStation', this._resources);

Choose a reason for hiding this comment

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

Please do remove these comments, I don't think they are being used or are useful for future reference

Copy link
Author

Choose a reason for hiding this comment

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

done

Copy link

@CrimsonJacket CrimsonJacket left a comment

Choose a reason for hiding this comment

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

Changes LGTM

@rxlxrxsx rxlxrxsx linked an issue Mar 16, 2023 that may be closed by this pull request
Copy link

@rxlxrxsx rxlxrxsx left a comment

Choose a reason for hiding this comment

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

Recent changes LGTM!

@vic-en
Copy link
Author

vic-en commented Mar 16, 2023

closing in favour of hummingbot#65

@vic-en vic-en closed this Mar 16, 2023
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.

Failed Test PR #9 - Error on yarn build (Dexalot)
7 participants