Inspiration

Decentralized exchanges enable an unprecedented paradigm shift when it comes to aggregation and distribution of liquidity. Never before was it possible to bootstrap an asset exchange without the need for license, expensive technical infrastructure, custody of assets and other complex matters. In addition, ability to share liquidity with automatic attribution of fees creates incentives for strong network effects.

As the industry progresses towards tokenization of traditional financial assets ("security tokens") there is no doubt financial protocols like 0x or Dharma have potential to play major role in this market. However, the open nature of this protocols creates challenges for institutional players who often are required by law to adhere to KYC and other regulations.

As a result, there is need for liquidity pools with on-chain verification that ensures all participants follow the rules ("Permissioned liquidity pool").

What it does

RegDEX is a 0x V2 - compliant relayer that uses SendWyre on-chain and off-chain APIs to verify users' information and allows trading only to users that completed the KYC process. When users come to the exchange, their current MetaMask address is automatically checked for verification status. In case the address is not verified, the KYC process starts.

In addition to predefined ERC20 pairs, the system pulls Dharma ERC721 Debt Tokens owned by the user in order to enable secondary market for Dharma debt.

How we built it

We used 8base platform to quickly build the backend application and the GraphQL API to manage orders. The platform is currently in private beta and is launching later in October. We used truffle/solidity to build smart contracts and React/Apollo for front-end.

Below is high-level technical overview:

  1. When user is verified through Wyre they get an ERC721 token corresponding to verification of their address.
  2. We implemented so-called Filter smart contract that is used to fill 0x orders. Before passing order fill to the Exchange contract, the Filter contract checks maker and taker balances of the Wyre ERC721. Balance of more than 0 means user has been verified.
  3. The relayer accepts only orders with 'senderAddress' set to the address of the Filter contract. That requires that Exchange.fillOrder is only called by the Filter contract and not directly by users. That makes it impossible to bypass the verification and still fill orders directly with 0x.

Additional use case with Dharma protocol and Bloqboard API

Provide a widget to Bloqboard creditors to easily offer their Debt Token NFTs on RegDEX in a compliant manner (e.g. accredited investors only). This can easily be accomplished, since our relayer provides 0x Standard Relayer API.

Challenges we ran into

0x recently upgraded to v2, with significant changes across the entire spec. This created certain problems here and there, but we were able to fix them.

Accomplishments that we're proud of

It is truly fascinating to get a glimpse of the future financial infrastructure. In blows our minds to think how easy and cheap it will be for anyone to run an exchange in the future and how connected various liquidity pools will be.

Built With

Share this project:

Updates