CoZ dApp Comp #1
9th place

Switcheo

A decentralized NEO exchange

Switcheo is a decentralised exchange built on NEO’s blockchain. It supports trading of NEP-5 tokens and NEO system assets like GAS & NEO. It aims to be a truly decentralised exchange while still providing for a superb user experience.

group
Developers

RavenXce, henrychua, jackyeu

insert_link

See Switcheo in action

Watch how easy it is to login, buy and sell assets, cancel orders and withdraw assets on the Switcheo decentralized exchange.

Developer Q&A

Can you outline the basic functionality of Switcheo?

Switcheo is a decentralized exchange built on the NEO Blockchain. It allows users to trade tokens before they are listed on major exchanges.

Future implementations would be to integrate ERC 20 tokens into the token pool.

Who will use Switcheo and how will they benefit?

People who would want to offset their tokens after ICO launches, and people who may wish to trade NEO and ETH tokens on a decentralized exchange with full control of their wallets.

What language did you use for development?

Smart Contract - C#
Web App - Javascript ES6

What SDKs, APIs or frameworks did you use to develop Switcheo?

neon.js, neo-js-api, ReactJS

How would you describe your experience developing on the NEO platform?

Figuring out how the NEO blockchain worked as a pioneer with little examples to go on with was a fun and fulfilling experience!
.

What are your plans for ongoing development and adoption?

We plan on making a number of improvements.

1. Prevention of double withdrawals

An untested implementation of preventing double withdrawal is on our code repository branch here: https://github.com/ConjurTech/switcheo/blob/no-double-withdraw/switc heo/BrokerContract.cs

This uses a mark and withdraw strategy, with backtracking of the blockchain to the marked point to ensure double withdrawal does not happen.

2. Usage of DynamicCall

We hardcoded all known NEP-5 tokens in our contract as Appcall can only be done statically at the moment. We hope to push for the implementation of DynamicCall in the vm / compiler so that the contract does not need to be updated.

3. Refund of failed verifications

This will be done before mainnet deployment.

4. Runtime.Notify

We did not implement this yet due to compiler issues and uncertainty about how this will be used in future. Once confirmed, we can use this to interact with clients / other exchanges before main net deployment.

Features

makeOffer

This allows users to make a asset swap offer on the contract.
The params required are:

i. script hash of the offer maker (invoking user)
ii. script hash of the asset being offered
iii. amount of asset being offered
iv. script hash of the asset wanted in return
v. amount of asset being wanted

SystemAssets must be attached if they are part of the fill. Once invoked, the offered amount will be transferred to the smart contract, and the offer will be placed on the blockchain for anyone with the corresponding assets to fill. NEP-5 tokens and SystemAssets are the currently supported asset types.

cancelOffer

This allows a user to cancel a previous offer that has not been completely filled.
The params required are:

i. offer hash to be cancelled

Once invoked, the offer will be cancelled and any remaining balance will be credited to the user balance for withdrawal in a second transaction.
.

fillOffer

This allows users to fill an offer on the contract.
The params required are:

i. script hash of the offer filler (invoking user)
ii. offer hash of the offer to be filled i
ii. the amount offered that should be filled SystemAssets must be attached if they are part of the fill.

Once invoked, the offer corresponding to the second arg will be filled. Partial filling is possible.
Amounts will be transferred to the maker and filler for withdrawal in a second transaction.

withdrawAssets

This allows users to withdraw their balance in the smart contract.
The params required (NEP-5) are:

i. script hash of the user to withdraw balance from
ii. script hash of the asset to withdraw
iii. amount of asset to withdraw

For SystemAssets, params are not required, but the transaction must be invoked with a TransactionAttribute of Usage 0xd1 and Data 0x01. We chose an implementation which uses transaction attributes instead of "method arguments" to prevent double withdrawals before main net deployment.

Our implementation currently does not allow a transfer trading of this balance and this operation must always be called to make use of the swapped asset.

“Undoubtedly, the future of crypto trading is decentralized. The Switcheo team made a substantial contribution towards this goal by presenting a fully functional and user friendly decentralized exchange running on the NEO Blockchain.”

Fabwa
City of Zion Council
city of zion

dApp comp #2

XXXXX GAS in prizes

Pioneer the new smart economy.

Learn more

Join the NEO Stack Exchange

The NEO Blockchain Stack Exchange site was proposed in order to give developers a place to ask questions, get answers, and discuss the NEO blockchain with each other. We're about halfway to getting the site to Beta status, and every commit to the proposal helps.

Commit to the proposal here!