A protocol for long/short trading of DeFi data streams

Demo Video Live Demo Source Code


Chainlink: Use Chainlink oracles to make a some sort of state change on the blockchain






The Overlay protocol offers users the ability to trade nearly any scalar, non-manipulable and unpredictable data stream. It recreates the dynamics of trading, but without the need for counterparties. It therefore completely solves the liquidity problems that occur in prediction markets (i.e. markets are so niche there is nobody trading), replacing them with an inflation problem. The Overlay mechanism is simple: traders enter positions by locking up OVL tokens in long or short positions on various data streams offered by the protocol. Data streams are obtained via reliable oracles. When a trader exits that same position, the protocol dynamically mints/burns OVL based off of their net profit/loss for the trade. The contract then credits/removes OVL tokens from the trader's balance and adds/subtracts from the total existing supply of OVL. Protocol revenues come from trading fees charged in OVL on each trade. Fees are sent to a community-governed treasury, with incentives for secondary market liquidity providers. This secondary market incentive creates a feedback loop to offer a reliable price feed for OVLETH on the Overlay trading platform, that traders can then use to hedge out OVL risk.

How It's Made

The Overlay protocol smart contracts are built with Solidity and inherit from OpenZeppelin's open source contracts library for tokens and access control logic. The OVL synthetic token is an ERC20 token with additional mint() and burn() functions callable only through special AccessControl privileges granted to each Overlay market position contract upon deployment. Overlay market position contracts are implemented as ERC1155 tokens to allow for transfers/sales of positions off-exchange on secondary markets. They represent a trader's position received upon locking up OVL in a trade on a data stream, with unique identifiers as attributes of the position itself: Lock price, long/short side, leverage factor. Each market position contract fetches price data upon building or unwinding a position from an associated OVLFeed contract, which is deployed with the market position contract. The feed contract is effectively a proxy for the underlying price data stream. The OVLChainlinkFeed implementation uses Chainlink price feeds on Rinkeby, which the market contract then uses to alter its own state and is live with the demo. The OVLUniswapV2Feed is a slight adaption of the Uniswap/uniswap-v2-periphery ExampleSimpleOracle, but is untested and has not been deployed to Rinkeby. Front-end is built with React JS and Bootstrap.


Michael Feldman
← click here to see all projects