New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loopring Protocol: Build a DEX or Write a Fee Burning Contract (2 x $3,500) #7

Open
mfinestone opened this Issue Oct 5, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@mfinestone

mfinestone commented Oct 5, 2018

What is Loopring Protocol?

Loopring is a protocol for building decentralized exchanges or otherwise incorporating non-custodial exchange functionality. The architecture utilizes off-chain order messaging and on-chain settlement. Our order model allows for multiple disparate trading pairs to be matched in order-rings to improve liquidity.

http://loopring.org/about.html
https://github.com/Loopring

Loopring is awarding $7,000 in LRC across 2 separate projects

# 1 - Build a DEX or P2P trade platform (Prize: $3,500 in LRC)

Loopring’s design distinguishes between frontend and backend services.

On the frontend, there are wallets or GUIs that users/traders interact with. On the backend, there are relays/ring-miners who match orders, effectively providing Matching-as-a-Service (MaaS). These two functions cooperate and share trading fees with each other in extremely flexible ways. Collectively, we call an entity that does both, a DEX.

For this challenge, we impose no restrictions. If you want to build a mobile Ethereum wallet or a web interface that speaks to our own reference ring-miner, that’s great. If you want to build your own backend relay/ring-miner, even better!

The reason we say “or P2P trade platform” is because Loopring supports another order type: P2P trades. In these cases, orders are not sent to ring-mining backends, but rather are matched directly with a counterparty. Basically, wallets are the only party in consideration here, no MaaS. P2P orders can be used for many applications beyond just sending trades amongst friends. For example, an ICO platform can use these orders to sell assets in the ‘primary’ market.

Examples
https://upwallet.io/index_en.html
https://loopr.loopring.io/

Docs
http://loopring.org/documents.html

We will judge based on a mix of:

  • Usability
  • Creativity
  • Technical difficulty

# 2 - Write an LRC Fee Burning Contract (Prize: $3,500 in LRC)

In Loopring Protocol 2.0, we have introduced a new fee model. One of the many changes is that a part of the fee earned by wallets and miners is reserved to burn LRC (we call this the burn rate). If the fee is paid in LRC this is straighforward, we simply burn the LRC directly. If the fee is paid in a non-LRC token however, we first have to sell the non-LRC token for LRC so the LRC can be burned.

Write a contract that sells the non-LRC tokens and burns the resulting LRC. You are free to sell the tokens in any way you like. Of course, we'd like to burn as much LRC as possible with these funds. Selling the funds should also be completely trustless. Anyone will be able to trigger the function that is used to burn the LRC.

Some ideas:

Implementation overview

As a part of the Loopring smart contracts, we have a dedicated contract holding all fees called FeeHolder. Contracts can be authorized to withdraw the part of the fees that needs to be burned. It's up to these contracts to implement a way to sell the non-LRC tokens in some way for LRC. The BurnManager currently can only burn LRC directly.

Getting started

Your folder should look like this:

+ MyFolder
  - protocol2
  - protocol2-js
  • Compile the loopring smart contracts.

See the readme at the protocol 2 repository.

npm install
npm run compile
  • Try to run the BurnManager tests to see if everything is working correctly.
npm run testrpc
npm run test -- transpiled/test/testBurnManager.js
  • Modify burn() in TaxManager.sol

Get In Touch

We’ll be leading a workshop on Friday at 11pm on how to build with Loopring, so please come by and say hello! Please also join our Discord for further help throughout the weekend or to find a hacking team/partner!

@xiaowheat

This comment has been minimized.

xiaowheat commented Oct 5, 2018

We have open source projects that you can start with.

Loopr Web
https://github.com/Loopring/loopr

Loopr iOS
https://github.com/Loopring/loopr-ios

Relay API
https://loopring.github.io/relay-cluster/relay_api_spec_v2.html#loopring_getticker

Example:

curl -X POST \
  https://relay1.loopr.io/rpc/v2 \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{
	"jsonrpc":"2.0",
	"id": 64,
	"method": "loopring_getTickerBySource",
	"params": [{
		"tickerSource": "coinmarketcap",
		"delegateAddress": "0x17233e07c67d086464fD408148c3ABB56245FA64"
	}]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment