October 4, 2019

Vulcan Swap is a decentralized "cost averaging" dApp built on Ethereum.

It allows a user to place a token<->token or Ethereum<->token trade order, with the principal amount divided into equal batches, each batch being executed at an equal time-interval. It's a mouthful made understandable by a simple example:

Use 100 DAI to buy Ethereum, in 10 batches, one batch per day, starting now.

Cost averaging is a strategy from the investing world that provides two key benefits:

  1. It removes emotions from buy/sell decision-making
  2. It lessens the effects of volatility by accumulating/distributing a position at a time-averaged price.

In case you haven't noticed, cryptocurrency markets are ruled by a triumvirate of volatility, FOMO, and FUD, all of which make investing a potential illogical time-sink.

Like its namesake people, Vulcan Swap provides for emotion-free, logical decisions.

Go long and prosper like a Vulcan

 

How it works (the user journey):

  1. Alice inputs an order to "use 100 DAI to buy Ethereum in 10 batches, daily".

  2. Each day, Alice receives 10 DAI worth of Ethereum at the current market price, until her 10 orders are complete.

That's it!

How it works (behind the scenes):

  1. Alice sends 100 DAI to the main smart contract.

  2. The smart contract records the order details and immediately swaps the first batch via Uniswap (the Uniswap liquidity pool determines the rate).

  3. Alice's remaining 90 DAI balance is loaned to Compound and starts accruing interest.

  4. An AWS serverless function calls the main smart contract regularly (currently every 10 minutes) to check if any order conversions are due. If Alice's next order is due, it submits a transaction that redeems 10 DAI from the Compound loan and executes the next swap.

  5. After the 10th (final) swap, there is a remaining cDAI balance that represents the interest on Alice's loaned principal. This remaining balance is re-allocated to the contract's fees and the order is marked as completed.

 

Technical contributions: "innocuous centralization" and an alternative fee model

The Vulcan behind the curtain is a combination of:

  •  an Ethereum smart contract (storing orders and trade execution logic)
  •  Uniswap (the actual trades)
  •  an AWS serverless architecture (simulating a cron job)
  •  Compound Finance (for accruing interest on inactive capital)

The most interesting technical takeaways - IMHO - are:

1. Lending solutions like Compound Finance present innovative opportunities for indirectly imposing a service fee.

Compound finance logo

Compound.finance is a cryptocurrency lending platform with an API that developers can leverage to integrate lending and borrowing into their apps.

That said, there are a few problems with this approach. For starters, the lending interest rate for DAI fluctuates around 10%, while the rate for ETH and other ERC20 tokens is way too low to be profitable. ETH was 0.03% at the time of writing.

One potential compromise that I would explore if Vulcan Swap were taken to mainnet would be to have free DAI or USDC (a 5% interest rate) orders, but a modest fee for ETH or other ERC20 tokens. It might also be interesting to give users the choice of whether they want zero fees for assuming the systemic risk of lending out their principal, or opting for a modest flat fee.

 

2. Proven, centralized solutions like AWS have a place in decentralized applications.

Amazon web services logo

Amazon Web Services provides proven, well-vetted serverless service integrations that allow a developer to reliably execute code without a backend architecture.

This is particularly true where there is little to no benefit in decentralizing a feature. I call this "innocuous centralization," and a technical exploration of the AWS-enabled cron jobs of Vulcan Swap will be the subject of a later post.


Vulcan Swap is live on Rinkeby. Go long and Prosper at www.vulcanswap.com!

On Github: https://github.com/SeanJCasey/vulcanswap-truffle