LQDEX
LQDEX
Published in
5 min readNov 2, 2018

--

LQDEX is pleased to announce the direct EtherDelta integration on LQDEX Bridge. As of November 1, 2018, LQDEX Bridge will be available on Testnet. The LQDEX team is hard at work resolving UI/UX issues with the integration. As we prepare for the Mainnet launch of LQDEX Bridge in the coming weeks, we wanted to present a working version of the product.

LQDEX Bridge features a simplistic design, which is dictated by EtherDelta’s smart code for posting and filling an order.

Captured below: the initial order page where there are options to post an order or bid on the EtherDelta order books directly.

Order Step 1: Select the Bid

Most of the input elements in the above the screen are self-explanatory. It shows that we own 0.0001 LQ-BTC and we are about to bid on buying 0.001 LQ-LTC. This is just bidding and not filling an order as it just placing your bid on EtherDelta’s order books. Metamask is required for using EtherDelta integration.

Order Step 2: Approve the token amount

The next step in the process is to approve the specific amount of LQ-BTC that you own to EtherDelta’s contract address.

As you can see above, our Ethereum address is automatically picked up from the Metamask login. We are about to approve 0.0001 LQ-BTC to EtherDelta contract as the owner. Once the approve button is selected, Metamask will be used to sign and send the transaction to the LQ-BTC token contract to approve.

The next step in the process is to deposit the tokens to the EtherDelta contract in which EtherDelta’s deposit function will be called.

The contract code where Bridge integrates with EtherDelta for depositing LQ-BTC that is minted by Bridge is shown below.

```function depositToken(address token, uint amount) {//remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf.if (token==0) throw;if (!Token(token).transferFrom(msg.sender, this, amount)) throw;tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);Deposit(token, msg.sender, amount, tokens[token][msg.sender]);}```

Order Step 3: Deposit the LQ-BTC token

The image above enables users to deposit their tokens to the EtherDelta contract directly — this must be done after at least deposit amount of tokens have been approved in the previous step, as EtherDelta’s contract uses the transferFrom function. The Etherscan URL for the approval step is also provided. . It shows that we are about to deposit 0.0001 LQ-BTC to the EtherDelta contract.

Order Step 4:

This is the final step in which the order (bid) will post on the EtherDelta’s order books. The following screenshot shows this final step:

As shown in the above screenshot, by posting a bid on the order books of EtherDelta, the user is agreeing to sell 0.0001 LQ-BTC for 0.001 LQ-LTC as long as there is a taker willing to fill the order.

To reiterate, all of the above steps require Metamask for signing the transaction, calling the EtherDelta contract method. This step will happen after approval and token deposit step.

The final confirmation screen is shown below — the order has been posted on EtherDelta. Please check the EtherScan URLs below to confirm the order was placed.

The above screenshot is the final screen that confirms that your bid was safely placed on the EtherDelta’s order book.

Bridge provides the users the ability to fill the orders directly from the Bridge UI, and only orders that have been bid from the Bridge UI are available to fill on the Bridge UI.

The following set of steps are required for filling an existing order that is on EtherDelta’s order book. Although these orders can be posted or filled without using Bridge integration, we went a step ahead to provide smooth integration.

Fill Step 1: Choosing the order to fill page.

The above screenshot shows that there are several orders that are sorted by time added. Users can select any of the above active orders to fill, unless they have been filled by other app or EtherDelta, these orders should be active.

Bridge will periodically check which orders are still active on EtherDelta, in the case that orders have been filled outside of the Bridge UI.

Suppose we choose to fill the first order in the list, the next step would approve the 0.001 LQ-LTC token.

Fill Step 2: Approve LQ-LTC token.

Once approve button is clicked, Metamask pops up requesting a signature for the transaction to approve the tokens to be filled. Below shows the screenshot of it.

This process is similar to approving the tokens during the posting a bid phase.

Fill Step 3: Deposit the filling token.

This step involves depositing the exact amount of tokens necessary to fill the order — at this time we are not supporting partial orders but our team is developing the capabilities to do so.

The deposit screen (captured above) shows how much of LQ-LTC you are depositing, and from which Ethereum address. This is pulled from the base account on Metamask.

The final two steps are similar to the order flow.

Above is the final confirmation screen that is showing the status of order fill.

If you’re just now hearing about LQDEX Bridge, we recommend reading our previous two blogs, which discuss Bridge and explain how to mint or withdraw tokens.

We will be adding other coins such as Dash, Monero to our list of supported coins in the near future.

--

--

LQDEX
LQDEX
Editor for

LQDEX (pronounced "liquid-ex") is a decentralized, trustless, cross-chain digital asset exchange. LQDEX.com