What it does

Discover and trade amazing NFTs

NFT Exchange lets you trade your NFT with any other NFT. The platform provides a safe and decentralized avenue for owners to put up their token for trade where other owners can browse and offer their own token in exchange. If the offer is accepted, the exchange takes place.

Motivation

While it is commonplace for Non-Fungible Tokens (NFT) to be sold for cryptocurrency instead, a service to swap a pair of NFT directly opens up other possibilities. For collectors or long term owners who wish not to sell their prized item for money, but would be willing to exchange them for other desirable tokens, NFT Exchange would be the perfect place to start.

Also, with the adoption of blockchain technologies becoming more mainstream, NFT could someday represent physical assets like cars and real estate, or important legal documents. In which case direct exchange of NFT would be appropriate; buying a house could mean exchanging mortgage binding agreement between a bank and a purchaser.

Features

  • Interactive user interface accessible from any device with a web browser
  • Put NFT up for trade by creating a listing, with option to write what you're looking for in the listing
  • Browse other listings to discover interesting NFTs
  • See an NFT you like? Offer up an NFT to exchange for it
  • Manage your listings and offers with a single click.

Process

How we built it

A key criteria we strive to achieve in NFT Exchange is decentralization for trustlessness and security. In order to achieve this the entire exchange process has to be executed by smart contracts on the blockchain.

We also wanted NFT Exchange to work on any NFT available today. Hence we designed the exchange contract to interact with all other NFT contracts through inter-contract call (Stratis SmartContract.Call function). This meant that we needed to call functions that is sure to exist on all other NFT contracts. For this, we used the ERC-721 standard interface which is the most widely used standard today. We limit contract calls to only two functions: TransferFrom and OwnerOf, to verify the owner of an NFT and to make transfers.

The exchange contract itself does not store the data properties of the NFT token, only the information required to perform the transfers (ie: NFT token id, seller and buyer addresses)

Process

  1. Seller transfers their NFT to exchange contract for listing.
  2. Exchange contract creates a listing record tied to the receiving NFT and the seller address.
  3. Buyer transfers their NFT to exchange contract as offer to a listing.
  4. Exchange contract creates an offer record tied to the both the receiving offer and listing NFT and owners.
  5. If seller accepts the offer: Exchange contract transfers the offering NFT to the seller and the selling NFT to the offerer, and mark both listing and offer as completed.
  6. If buyer cancels an offer, the offered NFT is transfered back to the buyer and the offer status is invalidated.
  7. If seller cancels a listing, the listed NFT is transfered back to the seller and the listing status is invalidated. For offers to this listing, the buyer can cancel the offer to reclaim their NFT.

Technologies

Process

Frontend Application (UX)
  • The front end web application is developed in React with NextJS framework.
Blockchain Smart Contract
  • NFT Sample Contract: Stratis Smart Contract writen in C# representing a sample NFT implementing the ERC-721 standard. This contract is used to create dummy NFT for development, testing and demo.

  • NFT Exchange Contract: Stratis Smart Contract writen in C# of the actual NFT Exchange contract. This contract is responsible for all manner of the NFT Exchange. See NFT Exchange Contract functions for functions.

NFT Exchange Contract Functions
Function Description
CreateListing Creates a listing of an NFT token making it available for receiving offers.
MakeOffer Makes an offer for an NFT listing, providing an NFT token as the offer item.
AcceptOffer Accept an open offer and performs the exchange transaction by transferring the offered NFT to the seller and the listed NFT to the offerer.
CancelOffer Cancel an open offer. Invoker must be the offerer of this offer.
CancelListing Cancel an open listing. Invoker must be the seller of this listing.

Challenges we ran into

As we wanted NFT Exchange to work on all other NFTs, during the planning and design stage we realized we had to way to conduct an end to end testing of the exchange without having some NFTs to try on.

We ended up developing an entire NFT Sample contract just for the purpose of testing and development of the NFT Exchange contract.

Accomplishments that we're proud of

We started the hackathon late with only a month of planning development time. We were able to complete the design and development of the smart contracts, and also went on to build a MVP frontend web application for user interaction with the platform. Given the short timespan, we are happy with the progress we made and the learnings we gained on Stratis blockchain.

What's next for NFT Exchange

Our next step is to prepare a holistic roadmap of the project where initial effort would include planning for marketing activities and doing a complete UI refinement of the current MVP application. Future stages of development may include public APIs for integration with other platforms.

Built With

Share this project:

Updates