Integrating with 0x

Charles Crain
SuperRare 💎
Published in
3 min readJan 11, 2019

Our mission at Pixura is to make it easy to publish, sell and trade virtual goods. Since launching SuperRare last year, over $50,000 has been earned by digital artists through our beta smart contract. Next, we’re releasing of the mainnet beta of the Pixura platform, allowing anyone to easily launch a branded storefront and sell NFTs.

Looking to the future, we’ve thought about how best to maintain and scale a marketplace platform that can offer users the most valuable real-world features as the Ethereum ecosystem evolves. The 0x team continues to prove that they’re one of the best in the space, and have built an impressive, feature-rich protocol for trading tokens on Ethereum. So, we’re happy to announce that the Pixura is integrating with 0x!

We’re really excited to start building features with 0x-powered capabilities such as arbitrary ERC20 support for marketplaces (enabling Dai stablecoin purchases), swapping ERC721 tokens as a trade, and the ability for new users to have their gas paid for them. And, the 0x team ships code at an eye-watering pace, so we look forward to working with the team as they improve and continue to build out the protocol in 2019.

Our indexer is now tracking events on the 0x smart contracts. Feel free to check out our GraphQL API and explore activity happening on the 0x exchange.

As an example, one can easily find the number of filled orders to a specific ERC20 contract. Here’s a query to get the total orders filled where MKR is sold:

Here we are using the condition argument to get orders that have a matching makerAssetData.

For those unfamiliar with 0x orders and how they work, the makerAssetData indicates:

  1. the type of asset the maker(seller) wants to sell, 0xf47261b0 for ERC20 tokens.
  2. the address of the ERC20 contract the maker(seller) wants to trade.

For more details checkout the 0x specification.

The response to the query at the time writing this post is:

As you can see we get the total count of filled orders selling MKR tokens.

Another example would be a query for a relayer to get the latest canceled orders. One might do this to see if any of the hashes of the canceled orders match hashes in their order book:

In this query I am asking for the last 3 canceled orders and ordering the results by the block timestamp.

The query currently responds with:

This is just the beginning of our integration with 0x. We are currently adding our own relayer that will expose orders via the standard relayer API, as well as, the Pixura GraphQL API. The advantage to the GraphQL API being the ability to join orders details on specific ERC721/ERC20 token data.

We support arbitrary ERC20 and ERC721 contracts; any contract compliant with these token standards can be indexed within Pixura to be accessible via the GraphQL API and up to date changes through web socket connections.

The indexer maintains the state of ERC721/ERC20 tokens including arbitrary JSON for token metadata. This makes querying tokens, token metadata, and historical data quite simple.

To join the conversation and stay up-to-date join our Telegram.

With love from the Pixura team.

Special thanks to the 0x team, benjie for his work on graphile, the FOAM team for their work on hs-web3 and valderman for the work on selda.

--

--

Charles Crain
SuperRare 💎

Founder, Pixura Inc. Functional Programmer. Crypto Entrepreneur.