Skip to content

Instantly share code, notes, and snippets.

@retotrinkler
Last active August 21, 2017 12:53
Show Gist options
  • Save retotrinkler/70d7984a0912a702fa17f155abf351a6 to your computer and use it in GitHub Desktop.
Save retotrinkler/70d7984a0912a702fa17f155abf351a6 to your computer and use it in GitHub Desktop.
Melon Challenge

Motivation

We are looking for someone with strong analytical skills - who can help us w defining parameter values for the Melon protocol but is also strong in building reference implementations (most likely Haskell, Scala or WebAssembly)

Description

Melon funds are intended to be technology regulated funds. Meaning the code in place should prevent embezzling of Investors investments in Melon funds.

The same way you don't need an Accountant to check the balances of the Bitcoin blockchain after each trade - you should not need a Fund Administrator (entitiy enforcing rules of Regulator) when using Melon funds (ofc you always can if preferred).

Melon Fund Structure

All assets are held in the Melon Vault from there we can code rules into the Vault contract on how one can manage the fund.

Challenge

Find a solution to the following two problems:

  1. Prevent buying orders at a price that is not beneficial for investors, i.e. (significantly) worse than market price.
  2. Prevent buying too much of a illiquidasset, i.e. restrict volume of trades

For point 1. its fine to restrict trades according to a given true price see below. For point 2. one solution could be analysing historical crypto data and modelling market impact to determine costs of trading out of illiquid assets and determining cost incurred by investor.

Assumptions

You can assume that you know the true price p_[P] for a given asset pair P that is the current price of an asset pair taken from multiple exchanges; Something similar to the CryptoCompare Methodology. See also (Best execution principle)

Example (Testnet)

This was a very basic version of risk managment. Essentially it restricted managing of the fund to only taking orders from the liquidityProvider (which was us). So as long as the liquidityProvider provides orders at market prices the track-record of these Melon funds is real!

This solved the too main problems:

  1. Prevent buying at a price that is not beneficial for investors.
    • Solution: Liquidity Provider always provided orders according to the true price
  2. Prevent buying too much of a illiquidasset
    • Solution: Liquidity Provider continuously provided orders for all relevant asset pairs.

Bonus Points

Can be useful

Market Impact

Solidity

Data source bitfinex

If there are any questions am v happy to help.

Wish you the best of luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment