Ash Milestone Report №3

Midas Tech AG
ash_blog
Published in
12 min readMay 19, 2020

In 2019, we were very excited to become the first project to submit a Melon funding proposal and see it accepted by the Melon Council DAO. Shortly afterwards, we published our 1 year roadmap. 12 months have passed and a lot happened, both for us as well as in the crypto space. With this report we release our last piece of the 1 year roadmap in order to share with the broader community what we’ve achieved as well as some insight into what comes next. The milestone plan was divided into three phases and this blog will summarise the progress made during the third phase. Towards the end, we’ll give a brief overview about what we are working towards in the near future. The following list gives an overview of the tasks according to the milestone plan as it was agreed on between Midas Technologies AG and the Melon DAO.

  • Main Milestone 1: Development & open sourcing of Copy-trading module
  • Main Milestone 2: Development & open sourcing of Multi-Manager funds module
  • Main Milestone 3: “Beta Season” Tournament
  • Main Milestone 4: Report on legal situation of Melon-based apps

Main Milestone 1: Development & open sourcing of Copy-trading module

1. Introduction and Preparation

The goal was to build a module that enables Melon funds to copy the position of other Melon funds. This documentation explains how we implemented the PoC-stage of copyFunds-module for the @melonproject/protocol. To generate a proof of concept setup we needed to be able to:

A. get the holdings of a given fund
B. compute the shares of every asset from the fund
C. generate the buy-values of every asset using the total investment amount and the computed shares of step B.
D. make the orders with the values of step C.
E. sell the copied fund (all assets of step D.)

Overall this documentation is about `copyFund.js` which realizes step A-D and `sellCopiedFund.js` which realizes step E. All needed functions for those two scripts are mostly implemented in `wrapperMelon.js`. Also important is the `copyFundsLogger.sol` contract, which is deployed on Kovan and which is used to be able to sell the copied funds again. The `poc.js` script uses all needed functions and is thought to be the “test-case” for the proof of concept.

2. The module

Here we give a detailed overview of the essential functions and also provide explanations of them.

A. Get holdings
The very first and simplest step is to get the holdings of “logged in” (metamask, ec.) account and of a given address. Both are implemented in `wrapperMelon.js`.

B. Computations for B. and C.
To be able to copy a fund we need to know the shares of every asset, so that we then can multiply our investment amount with every share and we get the amount we need to buy of this given asset. These calculations are made in `copyFund.js` after getting the holdings.

First we compute the AUM of all holdings without WETH, since WETH is the base currency to trade. To get the share of an asset we just need to get the amount of this asset and divide it by AUM of all assets together. Multiplied by investmentAmount we get the value in WETH we need to buy of this asset. To get the amount of token we just need to divide the `valueWETH` by the WETH-rate for the token.

D. Make orders
To place the orders on exchanges we use `makeOasisDexOrder` delivered by @melonproject/protocol and wrapped it for our use to `makeOrder` in `wrapperMelon.js`.

To be able to sell a copied fund we created a logging contract, `copyFundsLogger.sol`. On the bottom of the picture you see the function which logs the needed infos into the contract on the blockchain.

E. Sell copied fund
The logger makes this very simple. We get the logged fund by `getLoggedFund(fundaddress)` implemented also in `wrapperMelon.js`. To get the specific amount of WETH we just multiplied the token amount we had bought by the current WETH-rate. As for the buy orders we use `makeOasisDexOrder` to open the sellorders.

Also we need to unlog the sold fund in the logger contract on the blockchain. This is done via `unlogFund(fundaddress)`.

3. Testing

copyFund()
we will copy a mono- asset fund, (ZRX) from “destFund” to the “srcFund”. Therefore we needed to buy “makeOrder” from “srcFund” which can then be taken by the “destFund”. Here you see the described implementations from `poc.js`:

We should have seen one successfully purchased new asset at “srcFund”. As this is logged in the “loggingContract”, we shall sell this asset again by using the “loggingContract”. In the end the loggingContract needs to be empty for `getLoggedFund` by the “srcFund”.

sellCopiedFund()
I. using a manually logged fund for `sellCopiedFund()` worked as expected.

3. Conclusion

We see the module “copy funds” successfully implemented at the Proof of Concept stage. Next steps will focus on implementing hooks to check fund composition and enable continuous updating of the copied position.

4. Documentation

You can find the README here.

5. Published on Github

All code and documentation is published in the Midas Technologies AG Github here.

Main Milestone 2: Development & open sourcing of Multi-Manager funds module

1. General Information

The following functions are contained in the multiManager-module:

  • multiSigAddOwner
  • confirmTx
  • executeTx
  • beginSetupMSW
  • completeSetupMSW
  • makeOrderMSW
  • takeOrderMSW
  • cancelOrderMSW
  • returnAssetToVaultMSW
  • redeemMSW

To handle this module it is recommended to mostly advance the gas limit when confirming a proposed multiSigTransaction, otherwise it will run out of gas and you need to redo the confirmation. After opening a makeOrder with the ‘BUY’ flag, the account is freezed for 30 minutes, after someone takes the Order, until one can make the next makeOrder.

2. Preliminaries

Use metamask browser extension (https://metamask.io/) as a wallet. There you also can export the PRIVATE_KEYs to integrate in the .env.js file. To get some kovan TESTNETether visit https://faucet.kovan.network/. In general the whole setup from scratch should work fine with 3 Ether.

First of all you need:

  1. one invested fund (WETH and at least one other tradeable asset)
  2. one multiSigWallet (min. 2 Owner)
  3. one invested multiManager fund

3. invested fund

To invest into a fund you need the PRIVATE_KEYsrc variable set with a minimum balance of 1.5 ETH. Basically you can run node runPoC with the file like here: https://github.com/Midas-Technologies-AG/MelonApp/blob/ad65b3c7e3df1f73cc0dbf27c8848efa78f2dc9c/Modules/multiManager/runPoC.js

It is just using setupInvestedFund2 from the melonWrapper.

4. multiSigWallet

Visit https://wallet.gnosis.pm/ and login/connect to MetaMask. Create a new MultiSig Wallet:

  1. give it a name
  2. set confirmations to a minimum of 2
  3. add at least one owner
  4. deploy and confirm tx via MetaMask
  5. Copy the address of your wallet and add it to the .env.js-file.

5. create MSWfund

Now you can run the same command as above, but with the file from here: https://github.com/Midas-Technologies-AG/MelonApp/blob/1b07c21c16e9b598eb4c79866a900baf6e1e7199/Modules/multiManager/runPoC.js which basically executes those two funcions:

Now you need to go to the multiSig wallet https://wallet.gnosis.pm/ and confirm first the beginSetup() function as well as wait until it is successfully executed before you confirm the second one. Otherwise the second fails and needs to be executed again and so on.

So you should see 9 tx like in this picture:

IMPORTANT: change the gas while confirming with the second account and start with the lowest ID.

To be sure all tx don’t run out of gas add a 4 in front of “Gas Limit”:

  1. 2,703,244 (https://kovan.etherscan.io/tx/0x0856bd39106cd96e5058b6244665689bc8e354fcd2990c3c699326be78b339cf)
  2. 2,187,32
  3. 1,540,364
  4. 3,682,303
  5. 1,260,900
  6. 1,262,465
  7. 4,057,974
  8. 973,420
  9. 3,118,282(https://kovan.etherscan.io/tx/0xbd4cfedaa5e6776849f0a0efd5eede1b76c1402fd2f15550776390b87d39c3fe)

Now you can run console.log(await getRoutesOf(mswAddress)) and it will work fine:

accounting: ‘0x256d8D56daE86185e1df8B6C8A243EdDdF7B9fEb’,
feeManager: ‘0x96FE31D8D74584c4e880dee29F9506f92A1A7ae2’,
participation: ‘0x8107AcC2aB89d8A1547A7270dE65e419000F7E5b’,
policyManager: ‘0xed65e9dE085892FfDBF1a323a4C5d4fae520f2f7’,
shares: ‘0xfA6910D269FE933F74E68c6D90881dAC820Aa420’,
trading: ‘0x401Ed3A28B75b7BC3963F2a936754173c75Df41e’,
vault: ‘0xCfF1bC99258b1f20e21762e132CDAce116B46B11’,
priceSource: ‘0x385a59e848f6456ADf19C367c8cf03FD39c23FAB’,
registry: ‘0xb8ACdbE95e9980fae93716ebA27709BCF1765A12’,
version: ‘0x160386e65C129C43AdA6496ED0ec2Ec63040f0Bc’,
engine: ‘0x8fe493CaF7Eedb3cC32aC4194ee41cBa9470e984’,
mlnToken: ‘0x2C2edf394638931eb672BD9261d2AA1934874d45’

6. Invest in MSWfund

We invest from our baseAddress, because it is not possible yet to invest via a MSWwallet.
Before you run the same command as before, send via metamask to 0xd0A1E359811322d97991E03f863a0C30C2cF029C 1 Ether. This is the WETH contract and by default it will deposit you 1 WETH. After successful confirmation use these commands/this file: https://github.com/Midas-Technologies-AG/MelonApp/blob/3bc07153ed19c2173d891a1428fe5a7b80a5de6a/Modules/multiManager/runPoC.js

Proof of Concept

The following three functions are showing a fully functionable multiManager fund to trade ERC20-tokens using the @melonproject/protocol.

1. makeOrderMSW
If you try this here please read the note below and then open a buy makeOrderMSW(…​) for the token you got.

  1. run line 72 with any asset accepted and a token amount u want to buy (used commit 2521d7c)
  2. confirm with other MSW owners (adjust gasLimit!)
  3. check the 8th eventlog entry and make it visualize as number to get the order id created like here: https://kovan.etherscan.io/tx/0x7f89442c22707296ba1d2e10722b2337a7583f6485e5fd6fb7fe48a95a32c4ce#eventlog

So now we want to buy this Order 37511. Therefore we need the asset in the fund so that line 76 can execute successfully. Since we just have a fund without any assets as WETH we are going to use another fund with enough BAT. We opened the following orders for you to take, try await takeOrder(<yourOrderID>) and check via getHoldings() which token you got: 37516, 37517 and 37518. The makeOrderMSW transaction can be seen here: https://kovan.etherscan.io/tx/0x7f89442c22707296ba1d2e10722b2337a7583f6485e5fd6fb7fe48a95a32c4ce and it got taken by the investedFund here: https://kovan.etherscan.io/tx/0xf152928c6a44641c481ee391f287bb52d9b2ccf508f601588b383ce4b601d3a9

2. takeOrderMSW
Firstly, we need to have an openOrder we can use. Therefore we open a makeOrder from the fund having already BAT token.

Then run first line 90 and after your confirmation check the holdings of MSW again. Here you see the takeOrderMSW transaction: https://kovan.etherscan.io/tx/0xe39112e3414365478fe9ce527a10b0051e8df1cdbe8780b4a7d73a0558168e65

3. cancelOrderMSW
This is the quickest proof. Just create a makeOrderMSW + confirm https://kovan.etherscan.io/tx/0x2c8b9f19e5913f1ce09e9087d6189fdac66f0c842d077ef4ce6c8e2a3d13d6f9 and then directly cancel it via cancelOrderMSW + confirm via MSW https://kovan.etherscan.io/tx/0x09789da707e8b0c19206ca8fd20ce0612f3fbc2b0948e58206b588d821de6aa0

Next Steps

  • check if address is msw owner
  • invest in fund from multisig
  • timer for checking if makeOrder is possible
  • integration to existing products in the ecosystem

4. Documentation

You can find the README here.

5. Published on Github

All code and documentation is published in the Midas Technologies AG Github here.

Main Milestone 3: “Beta Season” Tournament

We originally planned to launch the first Ash Beta Tournament by the end of phase III of this milestone plan. Unfortunately we have not been able to announce a kick-off date yet. And those of you who are desperately waiting for the tournament will have to be a little bit more patient. At the moment we are searching for new funding in order to finance this essential phase of Ash. When we made a budget plan for our Melon Funding Proposal in 2019, we calculated a total of 1,090,000 CHF for an entire year of development (all three phases of the milestone plan 2019/20), including the Beta Tournament and a proper prize pool. Due to price fluctuations of MLN within the last year, we were only able to use around 60% of this sum. Major budget adjustments allowed us to deliver all milestones that were planned as open source contributions to the Melon community (check the last two milestone reports here and here) while constantly developing Ash. However, in order to make this next phase of Ash a real success, we need to be financially prepared. Hence, we are contacting venture capital firms and investors from all over the world in order to secure funding for the Beta Tournament. We aim at securing a total of CHF 1 mio. in order to cover development, the beta tournament maintenance, the prize pool, and for the next step: the preparation for our main net launch. Due to the COVID19 crisis a lot of companies are reassessing investments but we are confident that the Ash vision will attract strong partners who can support our next steps.

Status Update

The first Ash Beta Tournament is planned on Kovan and aims at giving users a preview of Ash functionalities as planned for the main net launch. A prize pool of at least CHF 100,000 is distributed over the whole season (minimum of 12 weeks) and is supposed to attract more users. In order to participate, users have to be onboarded through the Ash interface and connect a payment method of their choice (credit card, ApplePay, AliPay) to be able to pay fees for playing challenges. They also have the possibility to buy XP tokens from the Ash shop in order to refill their XP balance and play more challenges.

Done:

  • Development of Ash interface
  • Basic functionality like setup fund, invest/redeem, copy trading, multi-manager funds, VS mode, ranking
  • Signup list with more than 1,000 users

In progress:

  • Fiat payment service provider integration
  • Prediction market integration
  • Testing & debugging
  • Securing prize pool and maintenance of the beta for at least 12 weeks.

Main Milestone 4: Report on legal situation of Melon-based apps

You can find the full report here.

General Development:

XP token & challenge module testing

Every user joining Ash will use the Melon smart contract functions setupFund, requestInvestment & executeRequest, at least once to open a fund and make an initial investment. An additional driver for the Melon engine will be the transition of the challenge functionality from our back-end to the challenge module which manages challenges on-chain. Through this module, a slice X can be taken from every challenge fee and forwarded to the Melon engine.

In progress:

  • Design of challenge adapter
  • Design of challenge platform smart contract (as third party folder on Melon) to handle and track challenge IDs, stake, escrow, challenge duration, check fund prices before and after challenge
  • Conceptualization of amgu payment mechanism
  • Drafts and mockups for the in-app shop for XP sale (in the case that users lose all their XP due to a lot of lost challenge or in case they want to increase their XP faster, they can buy XP through a peer-to-peer XP market module. Midas Technologies AG will act as a main seller of XP on this market by selling XP for a fixed price)

R&D for technical implementation of KYC/AML integration

We contacted several providers in order to assess the best match in terms of offered functionality vs. emerging costs.

Next Steps — The Road Ahead:

1. Ash development

  • development of the challenge adapter
  • in-app XP store
  • implementation of Beta backlog features and bug fixes
  • Testing
  • Debugging

2. Beta Tournament

The first Ash Beta Tournament is planned on Kovan and aims at giving users a preview of Ash functionalities as planned for the main net launch. A prize pool of at least CHF 100,000 is distributed over the whole season (minimum of 12 weeks) and is supposed to attract more users. In order to participate, users have to be onboarded through the Ash interface and connect a payment method of their choice (credit card, ApplePay, AliPay) to be able to pay fees for playing challenges. They also have the possibility to buy XP tokens from the Ash shop in order to refill their XP balance and play more challenges. The first round of XP will be airdropped to new users. The Beta Tournament will be launched when the next round of funding is secured.

3. Main net Launch

Once the Beta Tournament is done, further user feedback has been integrated and all regulative questions have been answered, we are going to prepare the Launch on the Ethereum main net.

Questions or Feedback?

Telegram

Twitter

Email

--

--