<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Hydro Protocol - Medium]]></title>
        <description><![CDATA[Hydro Protocol is an open-source framework for building decentralized exchanges - Medium]]></description>
        <link>https://medium.com/hydro-protocol?source=rss----beb761129c95---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Hydro Protocol - Medium</title>
            <link>https://medium.com/hydro-protocol?source=rss----beb761129c95---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 25 Jun 2026 11:23:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/hydro-protocol" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Open sourcing beyond smart contracts]]></title>
            <link>https://medium.com/hydro-protocol/open-sourcing-beyond-smart-contracts-c8f3d21740ca?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/c8f3d21740ca</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Scott Winges]]></dc:creator>
            <pubDate>Thu, 23 Jan 2020 21:52:37 GMT</pubDate>
            <atom:updated>2020-01-23T21:52:37.002Z</atom:updated>
            <content:encoded><![CDATA[<h4>Open sourcing DDEX libraries to make it easier to interact with protocols and Blockchains</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*Np0ZA342QZ_be_IE_Xgy9g.png" /></figure><p>We’re open sourcing libraries we found most useful for interacting with the Ethereum Blockchain.</p><p>We’re starting by releasing 3 projects today, and will continue to release more in the upcoming months in an effort to give back to the community.</p><h4>Background</h4><p>In the past year, we focused on open sourcing high quality solidity smart contracts. However, we realized that for every developer who wishes to <em>deploy</em> production level smart contracts, many more simply wish to <strong>interact</strong> with blockchains to build interesting applications on top of existing protocols.</p><p>For example, if you wanted to create a twitter account that tweeted each time someone was liquidated on a decentralized exchange, you would need to automate a way to pull specific data from smart contracts and track these on-chain events. You don’t need to write/maintain a contract, you just need ways to interact with them. The watcher project below can be used for this.</p><p>By open sourcing useful utility projects that make it easier to perform common blockchain operations we are (hopefully) able to provide more value to the community at large.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*xCeYqNUOhSZksG8o.jpg" /></figure><h3>Open Sourced Now</h3><p>The first three libraries we’ve open sourced are ones that we use everyday. They could be useful for a broad spectrum of blockchain developers and enthusiasts.</p><h4>Ethereum-watcher</h4><p><a href="https://github.com/HydroProtocol/ethereum-watcher">https://github.com/HydroProtocol/ethereum-watcher</a></p><p>An extensible framework for listening to on-chain events and doing something in response. We use it internally to update our realtime front-end, create tracking dashboards, and handle critical events such as liquidations.</p><h4>Ethereum-tx-sender</h4><p><a href="https://github.com/HydroProtocol/ethereum-tx-sender">https://github.com/HydroProtocol/ethereum-tx-sender</a></p><p>A useful library to reliably send a transaction — abstracting away some of the tricky low level details such as gas optimization, nonce calculations, synchronization, and retries.</p><h4>Ethereum-jsonrpc-gateway</h4><p><a href="https://github.com/HydroProtocol/ethereum-jsonrpc-gateway">https://github.com/HydroProtocol/ethereum-jsonrpc-gateway</a></p><p>A gateway that allows you to run multiple Ethereum nodes for redundancy and load-balancing purposes. Can be ran as an alternative to (or on top of) Infura. It also includes handy features such as permission and rate limitations.</p><h3>Open Sourced Future</h3><p>Let us know if you find these libraries to be useful! Or if there’s other stuff you’d love to see us open source :)</p><p>Chat: <a href="https://discord.gg/g6C6jfB">https://discord.gg/g6C6jfB</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8f3d21740ca" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/open-sourcing-beyond-smart-contracts-c8f3d21740ca">Open sourcing beyond smart contracts</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lend, Borrow, and Trade USDC on DDEX]]></title>
            <link>https://medium.com/hydro-protocol/lend-borrow-and-trade-usdc-on-ddex-3e2556251f31?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/3e2556251f31</guid>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[decentralized]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[usdc]]></category>
            <dc:creator><![CDATA[Scott Winges]]></dc:creator>
            <pubDate>Fri, 13 Dec 2019 19:53:03 GMT</pubDate>
            <atom:updated>2019-12-13T19:53:03.050Z</atom:updated>
            <content:encoded><![CDATA[<h4>The ETH-USDC market is live on DDEX! Lend, borrow, and trade with up to 5x leverage</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-sBNDkuJn1Yi_0uZ1BJWlg.png" /></figure><p>The ETH-USDC market is officially live on <a href="https://ddex.io/margin/ETH-USDC">DDEX</a>!</p><p>While it’s still early, the USDC lending pool already has over $250,000 with currently ~40% utilization. You can now:</p><ul><li><a href="https://ddex.io/loans">Lend USDC</a> to earn interest</li><li>Create <a href="https://ddex.io/margin/ETH-USDC">USDC margin positions</a> with up to 5x leverage</li><li>Spot trade on the <a href="https://ddex.io/spot/ETH-USDC">ETH-USDC market</a></li><li>Stake ETH to <a href="https://ddex.io/loans">borrow USDC</a> for use on other platforms</li></ul><h4>Steady Growth</h4><p>Since our official launch a couple months ago, we have been steadily growing. We just hit a new high for value locked in DDEX:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/0*ZaLX8x6Y1DWtlpxL" /><figcaption><a href="https://twitter.com/DEXAG_TokenWire/status/1204883316052094976?s=20">Source</a> — DeFi Pulse and DEX.AG Twitter</figcaption></figure><p>We are excited to keep improving and growing as the DeFi space continues to evolve. Lots of new stuff coming to DDEX!</p><p>If you want to come chat with us — questions, comments, feedback, and suggestions are all welcome. Come find us on our <a href="https://discord.gg/g6C6jfB">Discord</a>!</p><p>Enjoy earning and happy trading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e2556251f31" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/lend-borrow-and-trade-usdc-on-ddex-3e2556251f31">Lend, Borrow, and Trade USDC on DDEX</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DeFi 101. Part 3— Spot Trading, Price Oracles, and Liquidations]]></title>
            <link>https://medium.com/hydro-protocol/defi-101-part-3-spot-trading-price-oracles-and-liquidations-e215fc17b36d?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/e215fc17b36d</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[lending]]></category>
            <category><![CDATA[decentralized]]></category>
            <dc:creator><![CDATA[Scott Winges]]></dc:creator>
            <pubDate>Wed, 11 Dec 2019 17:37:58 GMT</pubDate>
            <atom:updated>2019-12-11T17:37:58.794Z</atom:updated>
            <content:encoded><![CDATA[<h4>A 3-part series on decentralized lending, margin trading, and spot trading</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mq27HruL8BEPsUhTJERMlQ.png" /><figcaption>Missed the other parts? Check out <a href="https://medium.com/hydro-protocol/defi-101-part-1-lending-and-borrowing-15b4c9eef9d8">Part 1</a> and <a href="https://medium.com/hydro-protocol/defi-101-part-2-margin-trading-2b50d076deab">Part 2</a></figcaption></figure><h3>Recap</h3><p>Up to this point we’ve discussed <a href="https://medium.com/hydro-protocol/defi-101-part-1-lending-and-borrowing-15b4c9eef9d8">decentralized lending, borrowing</a>, and <a href="https://medium.com/hydro-protocol/defi-101-part-2-margin-trading-2b50d076deab">margin trading</a>. Let’s quickly touch on some of the big takeaways from the first two articles before diving into part 3.</p><p><strong>Lending</strong>: Decentralized loans are secured through the use of collateral, which is deposited by the borrower. Lenders deposit assets into smart contracts seeking interest from borrowers.</p><p><strong>Borrowing</strong>: Decentralized borrowers deposit collateral into smart contracts in order to borrow assets from lenders. If the value of the borrower’s collateral gets too close to the value of their loan, their collateral can be “liquidated” to pay back the loan.</p><p><strong>Margin Trading</strong>: The act of using borrowed funds to take leveraged positions on markets in an attempt amplify their gains/losses and to predict price changes. Margin trading is inherently high risk, high reward.</p><p>While in the previous two articles we have glossed over some of the infrastructure that is critical to pulling these features off for simplicity, part 3 will dive into these in a bit more detail.</p><p><em>Disclaimer: this series of articles is designed to be educational and informative. It is NOT investment advice. It is not an attempt to sway you into Margin Trading, nor do I assume any liability for your trades :) All trading, especially on margin, is inherently risky: please be careful and do your own research and due diligence!</em></p><h3>Part 3 — Decentralized Spot Trading, Price Oracles, and Liquidations</h3><h4>What is Spot Trading?</h4><p>Spot Trading is the act of exchanging one asset for another. An example of spot trading in the crypto space is trading 1 ETH for its current value in DAI (today it’s ~150 DAI). The word “Spot” essentially denotes that this is effectively just 1x leveraged trading.</p><p>While there are a ton of different ways you could do spot trading, the most discussed method in the context of DeFi is to trade your assets on a Decentralized Exchange (or DEX).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*G0E1JN8wfNOqMbBX2h7Opg.png" /><figcaption>Trading (whether margin or spot) is often accompanied with graphical representations of price history. Source: <a href="https://ddex.io/margin/ETH-DAI">https://ddex.io/margin/ETH-DAI</a></figcaption></figure><p>Spot trading markets are a critical component of the DeFi ecosystem. Lending, borrowing, and margin trading all rely on functioning spot trading markets of some kind. For lending and borrowing, spot trading is often used to maintain automated liquidations. For margin trading itself, in order leverage a position the borrower will have to use some sort of a spot trading market to trade their borrowed assets.</p><p>It’s fair to say that without a functioning spot trading markets, DeFi would be extremely narrow in scope.</p><h4>Lego Blocks vs Native Spot Trading</h4><p>Decentralized Margin Trading platforms actually have an intriguing decision to make: should I use my own spot trading market, or should I use someone else’s spot trading market? This is a completely new question that does not exist for centralized platforms.</p><p>The early versions of decentralized margin trading platforms were essentially <a href="https://medium.com/totle/building-with-money-legos-ab63a58ae764">lego blocks</a> built on top of existing decentralized exchanges. These platforms provided smart contract based layers for users to lend and borrow, while the actual trading that supported positions (and sometimes liquidations) was performed on a 3rd party exchange. <a href="https://www.nuo.network/">Nuo</a>, <a href="https://medium.com/@opyn_/next-steps-for-opyn-a802da8a67a6">the late opyn</a>, and <a href="https://fulcrum.trade/">fulcrum</a> <em>(also the early version of </em><a href="https://dydx.exchange/"><em>dydx</em></a><em>)</em> all use 3rd party exchanges to facilitate trades.</p><p>There are now two decentralized margin platforms that use a native exchange to facilitate trades: <a href="https://dydx.exchange/">dydx </a>and <a href="https://ddex.io">DDEX</a>. These margin platforms have their own spot trading markets which facilitate opening and closing margin positions. There are pros and cons to doing this.</p><p>The big pro is that using a native market allows users to make advanced order types. Since these platforms don’t have to rely on compositing multiple smart contracts together <em>(that may or may not fit perfectly),</em> users are able to see more professional trading features on these non-custodial platforms (eg. limit and stop-limit orders, position adjustment, etc.). Users also benefit from a few QOL benefits, such as lower gas costs, <a href="https://medium.com/hydro-protocol/breaking-down-the-flash-boys-dex-trading-bots-bloomberg-article-49c18eb649ac">no front running</a>, and instant order matching.</p><p>The downside is that these projects now need to focus a large portion of their energy on maintaining a powerful spot trading market. If they can’t offer competitive spreads and depths, then they will likely struggle to stay competitive in this emerging landscape.</p><h3>Price Oracles</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*701-YdiBr6uMKpKcvYUdNQ.png" /><figcaption>Boromir said it best!</figcaption></figure><p>In parts 1 and 2, we discussed the concept of comparing collateral value vs borrowed value as a way to determine whether a loan should be liquidated or not. What we didn’t discuss was how the values of these assets are determined. These values, or prices, are assigned through “price oracles”.</p><p>Price oracles come in a variety of shapes and sizes, some more centralized, some more decentralized, but the general concept is that price oracles provide a price for a given asset. While this sounds obvious, doing this 24/7 with no false values is more complex than you might think.</p><p>Centralized margin exchanges have used various shapes of price oracles for a while now, but even these have their own issues. Trying to decentralize the process makes some aspects easier (downtime), but some aspects much more complex (trustlessness).</p><h4>Why are price oracles important in DeFi?</h4><p>We mentioned before that borrowers have to deposit collateral in order to take out loans. So imagine that you’re a borrower who wants to borrow $100 of DAI using ETH as your collateral. If the platform requires a collateral rate of 150%, you need to deposit $150 worth of ETH. How does a platform determine what the current value of ETH is?</p><p>This is where price oracles come in. An ETH-DAI price oracle could say “the current price of ETH is $150”, thus the user would need to deposit 1 ETH for their loan. How does the price oracle come up with this value though?</p><p>You might say: why not just grab the mid-market price off of a big exchange? Not a bad idea, but what if the exchange’s servers go down? What if their market liquidity falls off? Or what if someone purposely manipulates the mid-market price of a market?</p><p>Price oracles achieve this 24/7 reporting in a several different ways. Generally they are based on some sort of price feed or aggregation of several price feeds. The data for the current value of an asset could come from a centralized price feed, a blockchain based price feed, or a variety of complex algorithms.</p><p>If you lend/borrow in DeFi right now: do you know where the price oracles are getting their data on the platforms you use?</p><h4>Incentive To Fail</h4><p>As a borrower, I would love it if the price oracle were to screw up and say that 1 ETH is worth 10 million dollars. With only 1 ETH as collateral, I could then borrow and withdraw millions of dollars worth of other assets. Talk about incentive! If someone could manipulate the price oracle to spit out a bad value, there is potentially quite a bit of profit to be made.</p><p>Because there are those who could profit off of price oracle failure, securing price oracles is an area of great debate in the DeFi community. An effective price oracle must be robust — <strong>any failure could be catastrophic</strong>.</p><h3>Liquidations</h3><p>So we learned that a borrowers collateral can be liquidated if the value of their collateral gets too close to the value of their loan. But what does this liquidation do exactly? Why is it needed and how does it work?</p><p>There’s actually not a perfect standard for this right now — it varies by platform. I’ll go over the main methods though.</p><h4>The Goal of Liquidations</h4><p>The goal of a liquidation is to repay the borrower’s loan.</p><p>Liquidations are designed to protect lenders from having their borrowers default on their loan. This is achieved by taking the borrower’s collateral and converting it into the loan they took out.</p><h4>How Liquidations Work</h4><p>Liquidations need to find a way to convert the borrower’s collateral back into their loan. So if a borrower used ETH as collateral to borrow DAI, the liquidation would need to SELL the ETH for DAI to repay the loan.</p><p>Simple then, right? Just sell the collateral off on the spot market and repay the loan — easy! Alas, only a few platforms actually use this method explicitly, and with good reason. If several large positions get liquidated simultaneously during periods of high market volatility, the spot market could potentially get drained of all liquidity. If the spread gets really large, then simply selling the collateral back on the spot market won’t completely cover the loan!</p><p>Instead, many platforms use 3rd party liquidator bots to perform these liquidations. These bots search for positions that can be liquidated — hoping to make a profit off of the ill-fated borrowers.</p><h4>Incentivizing Liquidations</h4><p>The 3rd party liquidators are incentivized to do these liquidations because they are hoping to achieve a better price than the current market rate. Different platforms provide incentives to liquidators in a variety of ways:</p><ul><li>Maker and DDEX both use a sort of dutch auction, where greater portions of the borrower’s collateral are incrementally offered to liquidators.</li><li>Other platforms like dydx offer an instant reward for the liquidators, like an automatic 5% off of midmarket price.</li><li>Some platforms just try to market buy/sell collateral on their respective spot markets to repay as much of the loan as possible</li></ul><p>These methods have different pros and cons. The dutch auction may be gentler to the borrowers, but potentially less profitable for liquidators and slower. The automatic reward structure is sweet for the liquidators, but can be pretty brutal for the borrower who is already licking his liquidated wounds.</p><p>Regardless of the method, a successful liquidation is one that always pays loan back!</p><h3>The Big Picture</h3><p>Thus concludes my 3 part series on DeFi 101! Congratulations on making it through!</p><p>I’m extremely excited to see the future development of this space. If you have any questions, want me to do another breakdown on something different, or just want to chat — come find me on the <a href="https://discord.gg/g6C6jfB">ddex discord</a>!</p><p>Thanks again for reading, and best of luck out there in this crazy decentralized world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e215fc17b36d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/defi-101-part-3-spot-trading-price-oracles-and-liquidations-e215fc17b36d">DeFi 101. Part 3— Spot Trading, Price Oracles, and Liquidations</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[New DDEX Margin Trading & Lending Platform Is Live!]]></title>
            <link>https://medium.com/hydro-protocol/new-ddex-margin-trading-lending-platform-is-live-9f9731ff63ae?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/9f9731ff63ae</guid>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[dex]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Scott Winges]]></dc:creator>
            <pubDate>Wed, 16 Oct 2019 16:29:15 GMT</pubDate>
            <atom:updated>2019-10-16T16:24:10.629Z</atom:updated>
            <content:encoded><![CDATA[<p>After two months of closed beta testing, the new DDEX is officially open for all users! You can check it out here: <a href="https://ddex.io">https://ddex.io</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LZ2O_mSJWM2oe9hzlXoJNQ.png" /><figcaption>Margin trading power on display with the new DDEX! Limit and stop-limit orders are naturally supported.</figcaption></figure><h3>Borrow, Lend, Trade — The New DDEX Is Here</h3><p>An all-in-one optimized solution to decentralized borrowing, lending, and exchange. On the new DDEX you can:</p><ul><li><a href="https://ddex.io/margin/">Borrow</a> assets and trade on margin <em>(up to 5x leverage)</em></li><li><a href="https://ddex.io/funding">Lend</a> assets to earn interest</li><li><a href="https://ddex.io/trading/">Spot trade</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/0*gJybNAZMrWl0geTq" /><figcaption>Opening a margin position on the new DDEX</figcaption></figure><p>Margin trading is inherently complex. While some users may want to easily open a position without too much hassle, others crave power features like limit and stop-limit orders.</p><p>So we created two modes for our Margin Trading: Basic and Pro. The basic mode allows you to quickly and easily open a position in 2-clicks. While the Pro mode provides advanced features like limit orders, stop-limit orders, and full position adjustment.</p><p>Our goal is to offer the most advanced decentralized margin trading experience to date.</p><h4>Entering DeFi’s Second Phase</h4><p>The first phase of DeFi focused on the creation of essential building blocks such as stablecoins, DEXs, and lending pools. Leveraging the composability of these “money-lego blocks”, early adopters figured out how to piece together projects to create innovative new workflows.</p><p>The early adopter DeFi developers have shown that:</p><ol><li>The final results of these <em>“do something here, do something there, then bring it back together”</em> workflows can be valuable</li><li>Abstracting composability complexity with thin UI wrappers has for the most part <a href="https://medium.com/@opyn_/next-steps-for-opyn-a802da8a67a6">failed to gain traction</a>, as the abstractions they present are <a href="https://en.wikipedia.org/wiki/Leaky_abstraction">leaky</a>.</li></ol><p>The next phase of DeFi will be about refactoring and streamlining key pieces from the ground up. The new DDEX is advancing towards this greater trend by combining borrowing, lending, and trading all into one cohesive, uninterrupted flow.</p><h4>The New DDEX</h4><p>All trading and lending on DDEX will be <strong>completely free of fees</strong> for our launch!</p><p><a href="https://ddex.io">The new DDEX</a> is open for everyone today. Test it out and let us know what you think :)</p><p>All questions and feedback are very welcome: come chat with us on our <a href="https://discord.gg/g6C6jfB">discord</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f9731ff63ae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/new-ddex-margin-trading-lending-platform-is-live-9f9731ff63ae">New DDEX Margin Trading &amp; Lending Platform Is Live!</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why USDT Actually Makes Sense For Decentralized Margin Trading]]></title>
            <link>https://medium.com/hydro-protocol/why-usdt-actually-makes-sense-for-decentralized-margin-trading-9396ec575fc3?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/9396ec575fc3</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[usdt]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Scott Winges]]></dc:creator>
            <pubDate>Fri, 13 Sep 2019 13:01:01 GMT</pubDate>
            <atom:updated>2019-09-13T22:07:46.300Z</atom:updated>
            <content:encoded><![CDATA[<p>Liquidity is vital to Margin Trading.</p><p>Greater liquidity leads to tighter bid-ask spreads, lower slippage rates, higher leverage rates, and robust liquidations. Both the borrower and the lender greatly benefit from increased market liquidity.</p><p>The demand for decentralized lending, borrowing, and trading is strong. Despite liquidity challenges, Decentralized Finance (<a href="https://medium.com/defi-network/opening-defi-42a5afdb71e0">DeFi</a>) has become an increasingly popular and rapidly expanding industry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*3PS0Khw3L3nh-9X4SNhOcQ.png" /><figcaption><a href="https://defipulse.com/">https://defipulse.com/</a> provides a historical chart of “locked” funds in DeFi across many different platforms. Trending up!</figcaption></figure><p>While DeFi trading volume is increasing, it is still currently dwarfed by centralized exchange volume. Liquidity is a commonly cited reason for this lack of market share. Prominent figures in the DeFi space are <a href="https://twitter.com/willwarren89/status/1166926098799611904?s=20">now voting</a> to bring in more liquid stablecoins such as Tether (USDT) into the ecosystem.</p><blockquote><a href="https://app.compound.finance/vote">https://app.compound.finance/vote</a> — USDT is currently #2 on Compound’s voting to add new markets, with over 175,000 votes.</blockquote><p>In this article, I will discuss why the desperate need for liquidity makes USDT a powerful candidate for use in decentralized margin exchanges.</p><h4>Why Margin Trading Must Have Liquidity</h4><p>In margin trading, the importance for liquidity is magnified even more than in traditional spot trading.</p><p>In both spot and margin trading, greater liquidity yields lower price slippage rates, tighter bid-ask spreads, and greater depths. These alone can make a huge impact on a trader’s profit/loss.</p><p>In addition to reaping all of the aforementioned benefits, increased liquidity also allows margin platforms to more safely offer higher leverage rates, further enhancing user purchasing power. <strong>More liquidity = more leverage.</strong></p><p>Also consider that Margin Trading is inherently reliant on lending — without assets to borrow, there is no margin. Market liquidity is also critical to lenders as greater liquidity leads to more robust liquidations. A failed liquidation means a socialized loss for lending pools, so smart lenders should be cautious if their assets can be used on illiquid markets.</p><blockquote>*The <a href="https://www.coindesk.com/margin-lenders-lost-13-5-million-in-may-to-poloniex-crypto-crash">Poloniex CLAM fiasco</a> is an example of failed liquidations on an illiquid market resulting a in a socialized loss for lenders. These BTC lenders probably had no idea that someone could use such a highly illiquid token like CLAM as collateral for their loan.</blockquote><p>To summarize: in addition to price benefits, increased liquidity yields higher leverage rates for their margin traders and greater security for lenders.</p><h4>USDT’s Liquidity</h4><p>My case for using USDT in decentralized margin exchanges is largely based on the fact that it has drastically more liquidity than the current popular stablecoins in the DeFi space. Currently, <a href="http://MakerDAO&#39;s">Maker’s DAI</a> is the most commonly used stablecoin in DeFi projects.</p><p>To be clear, I’m not arguing for the use of USDT exclusively. DAI provides a ton of value to the decentralized ecosystem — Maker’s DAI loans still dominate <a href="https://defipulse.com/">the decentralized lending leaderboards</a>. It is the addition of other stablecoins alongside DAI which further enhance the depth of the DeFi ecosystem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*oym7ys6dllTHTOwvKAp06A.png" /><figcaption>Current snapshot from <a href="https://coinmarketcap.com">https://coinmarketcap.com</a> — market cap and 24-hour trading volume for Tether (USDT) and DAI.</figcaption></figure><p>The image above compares market cap and 24-hour <em>(reported) </em>trading volume for USDT and DAI.</p><p>Liquidity and trading volume are <a href="https://www.investopedia.com/terms/d/dollar-volume-liquidity.asp">often synonymous</a>. Tether (USDT) has drastically more <a href="https://coinmarketcap.com/currencies/volume/monthly/">reported trading volume</a> than any other stablecoin. At the time of writing this article, the <a href="https://coinmarketcap.com/currencies/tether/">reported 24 hour volume for USDT</a> exceeds $20 billion USD, and accounts for approximately 33% of all reported daily cryptocurrency trading volume.</p><p>By comparison, DAI’s 24-hour trading volume is currently around $24 million USD. The difference between Billion and Million is large: USDT’s volume is multiple orders of magnitude ahead of DAI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*nscb_TTt4DmihcQRtp-8Cw.png" /><figcaption>Sorting by volume, USDT consistently outperforms everything else, including Bitcoin. <em>(source: </em><a href="https://coinmarketcap.com"><em>https://coinmarketcap.com</em></a><em>)</em></figcaption></figure><p>If liquidity is a hurdle for decentralized projects to overcome, adding in the most liquid stablecoin seems like a logical step. Despite the questionable reputation, USDT’s liquidity is undeniable.</p><p><em>All liquidity is helpful in this realm, it’s really the more the merrier. Coinbase is also contributing to the liquidity of the DeFi space through their USDC. They </em><a href="https://blog.coinbase.com/announcing-the-coinbase-usdc-bootstrap-fund-ed5e16ca4daf"><em>recently launched a fund</em></a><em> designed to inject millions of dollars worth of USDC liquidity into emerging DeFi projects.</em></p><h4>Ownership vs Speculation — Understanding Risk</h4><p>Using USDT as a stablecoin actually gives users who don’t believe in it more power: if they truly believe that USDT will collapse, they can profit off of this.</p><p>Margin Trading uses one asset to leverage another asset. While trading is involved, a margin position is effectively just a speculation on an asset’s price. You typically only hold assets on one side of the market.</p><p>If you’re going LONG on ETH, you don’t own the paired asset. You just <strong>owe </strong>it.</p><p>This forms an important distinction between ownership and speculation. In forming a LONG ETH position, it doesn’t matter if your quote token is DAI, USDC, or USDT: <strong>you only own ETH for the duration of your position.</strong></p><p>If the counter asset crashes, it’s actually beneficial for the LONG trader. The amount they owe just decreased in value!</p><h4>Summary</h4><p>Liquidity has been an ever-present challenge in the road for DeFi adoption. Using USDT in decentralized margin exchanges can provide drastic improvements to decentralized liquidity: <strong>allowing traders to reap the benefits of improved liquidity while circumventing any potential risk of holding assets they don’t believe in.</strong></p><p>Want to learn more or try our new DDEX Margin Platform? Come talk all things DeFi with us on <a href="https://discord.gg/g6C6jfB">discord</a>.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9396ec575fc3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/why-usdt-actually-makes-sense-for-decentralized-margin-trading-9396ec575fc3">Why USDT Actually Makes Sense For Decentralized Margin Trading</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Lending Pool Interest Rates actually work]]></title>
            <link>https://medium.com/hydro-protocol/how-lending-pool-interest-rates-actually-work-375794e71716?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/375794e71716</guid>
            <category><![CDATA[fintech]]></category>
            <dc:creator><![CDATA[Tian Li]]></dc:creator>
            <pubDate>Thu, 22 Aug 2019 20:56:38 GMT</pubDate>
            <atom:updated>2019-09-04T08:55:18.653Z</atom:updated>
            <content:encoded><![CDATA[<p>If you open up a DeFi <a href="http://loanscan.io">loan explorer</a>, you’ll immediately notice that there are many assets across multiple platforms, each with wildly different interest rates:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*Xrk-4tn-7PWPmvVH43CofQ.png" /><figcaption>How are interest rates set?</figcaption></figure><p>So how are these interest rates actually set? The short answer is “algorithmically by supply and demand”. This article goes through the longer version of the answer.</p><p>Most commonly, the interest rate for a decentralized lending pool is determined by a <strong>function</strong> which takes the state of the pool as input:</p><blockquote><strong>I(R)</strong></blockquote><p>Here, I is <em>Interest Rate </em>and R is the<em> utilization ratio. </em>An <em>R </em>0 means no assets are lent out. An <em>R</em> of 1<em> </em>means all of the assets are lent out.</p><p>Let’s first consider the trivial case where we simply ignore the state of the pool and return a constant interest rate:</p><blockquote><strong>I(R) = 0.2</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WgJuqGhibfn5xZy6l_hAfg.png" /><figcaption>A constant interest rate curve</figcaption></figure><p>A lending pool with a constant interest rate curve is setting the interest rate at 20% under all circumstances. A real world example is <a href="https://www.hbg.com/zh-cn/margin/">huobi</a>, which sets their interest rate at <a href="https://support.huobi.so/hc/zh-cn/articles/360000180262-%E6%9D%A0%E6%9D%86%E8%B4%B9%E7%8E%87">0.1% per day</a>.</p><p>As a centralized exchange, huobi can effectively give out an unlimited number of loans. For decentralized peer to peer platforms where loans are backed by real on-chain assets, it is generally desirable to choose an interest rate function that incentives a balanced utilization ratio. Under-utilization is bad because too little interest is generated, and over-utilization is bad because a tapped out pool can no longer meet borrowing demands.</p><p>Thus, let’s move onto a function which varies with utilization ratio:</p><blockquote><strong>I(R) = 0.2 + 0.3R</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ud0D6o4BWZu7mg79T_lKyA.png" /><figcaption>The yellow line indicates a linear interest rate curve</figcaption></figure><p>An increasing function makes perfect sense. If few people are borrowing, interest rate is lower. If a lot of people are borrowing, then interest rate is higher. <a href="https://compound.finance">Compound</a> is an example of a lending pool with a linear model.</p><p>Next, let’s consider higher order functions:</p><blockquote><strong>I(R) = 0.2 + 0.5R²</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZWTYOwHMbjs29vrT_Ky3hg.png" /><figcaption>Red indicates a non-linear interest rate curve</figcaption></figure><p>Why bother with a non-linear curve? One reason is to be able to tweak sections of the curve differently. In the median case, users appreciate a relatively stable, robust curve. In the extreme case where the pool is near illiquidity, the interest rate shifts rapidly in an attempt to restore balance.</p><p>The linear curve is already rewarding lenders for providing a scare asset during times of need. The non-linear curve goes beyond that. One justification for the additional reward is the existence of <strong>liquidity risk</strong>: if utilization rate is high and many lenders withdraw at the same time, then some of them must wait until outstanding loans are paid back.</p><p>Our decentralized margin exchange <a href="http://ddex.io">DDEX</a> uses a non-linear interest rate function. Another real world example is <a href="https://dydx.exchange">dYdX</a>.</p><p><strong>Points of Consideration</strong></p><p>To illustrate the similarities and differences between various real world models, let’s pick a few points along the curve and see what happens.</p><p>For reference, here are the actual interest rate functions for the stablecoin DAI for Compound, dYdX, and DDEX:</p><blockquote>Compound: 0.05 + 0.15R</blockquote><blockquote>dYdX: 0.15R + 0.85R⁶</blockquote><blockquote>DDEX: 0.10 + 0.4R⁴ + 0.5R⁸</blockquote><p><strong>R=0: Initial State, Minimum Interest Rate</strong></p><p>One interest point to consider is R = 0, the edge case where 100% of the assets are available. This is the minimum interest rate of the platform. Let’s plug in the numbers:</p><blockquote>Compound(0) = 0.05</blockquote><blockquote>dYdX(0) = 0</blockquote><blockquote>DDEX(0) = 0.10</blockquote><p>The philosophical argument for a non-zero interest rate is that stablecoin assets should demand an interest rate equal to or higher than the risk free rate of USD.</p><p><strong>R=1: Over-Utilized Pool, Maximum Interest Rate</strong></p><p>On the other end of the spectrum, let’s consider what happens when all the assets in the pool are loaned out, and the pool is in a state of illiquidity. In this scenario, we have the maximum interest rate of the platform.</p><blockquote>Compound(1) = 0.2</blockquote><blockquote>dYdX(1) = 1</blockquote><blockquote>DDEX(1) = 1</blockquote><p>The maximum interest rate is 50% for Compound, and 100% for both DDEX and dYdX.</p><p>dYdX and DDEX pools primarily exist to support margin trading, and a tapped out lending pool is really bad because trading is no longer possible. Compound is a more general purpose lending pool with an IOU system (cToken), so high utilization rate is not as undesirable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8Q7PuyyZrEbHInoUnH44_w.png" /></figure><p>Different curves make sense for different pools. At the end of the day, a good interest rate model is one that helps approximate the <a href="https://financial-dictionary.thefreedictionary.com/market+clearing">equilibrium interest rate</a>, where total borrowing demand equals total lending supply. Algorithmic interest rate models are the most popular solution today because they do a good job of this and are simple and easy to implement on-chain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=375794e71716" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/how-lending-pool-interest-rates-actually-work-375794e71716">How Lending Pool Interest Rates actually work</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decentralized Margin Trading and Lending is coming to DDEX]]></title>
            <link>https://medium.com/hydro-protocol/decentralized-margin-trading-and-lending-is-coming-to-ddex-f98f87a61079?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/f98f87a61079</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[fintech-startups]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[Tian Li]]></dc:creator>
            <pubDate>Mon, 22 Jul 2019 21:20:35 GMT</pubDate>
            <atom:updated>2019-07-22T22:16:26.019Z</atom:updated>
            <content:encoded><![CDATA[<p>We are excited to announce that a vastly improved DDEX with decentralized margin trading and lending is coming in August 2019.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1JXajYEni3rkw3naySKG6Q.png" /><figcaption>Decentralized margin trading and lending in one seamless experience</figcaption></figure><h4>A Seamless and Intuitive Experience</h4><p>Margin exchange is an elementary building block in open finance. Although it’s possible to create margin positions by manually transferring borrowed assets from a lending pool to external exchanges, a more automated approach is helpful for widespread adoption.</p><p>Currently there are a handful of teams working on decentralized margin exchanges. All of them are built on top of external, third party DEXs.</p><p>We are in a unique position where we can alter our DEX architecture and redesign everything with margin and lending in mind. This cohesive approach allows us to offer higher maximum leverage ratios, lower transaction costs, liquidity sharing between spot and margin trading, and a more intuitive user experience overall.</p><p>In addition, the new margin trading <em>inherits</em> many of the existing DDEX features such as limit and stop-loss orders.</p><p>For more information please see our <a href="https://medium.com/hydro-protocol/ddex-faq-margin-trading-bd4b32beb9f">in depth FAQ</a>.</p><h3>The Road Ahead</h3><p>Since launching DDEX in 2017, we’ve spent thousands of hours working on one of the top decentralized exchanges on Ethereum, with <a href="https://etherscan.io/dextracker?filter=4">over half a million transactions</a>. Our process for testing and auditing has resulted in a spotless track record when it comes to security and reliability.</p><p>Our goal is to create the best decentralized exchange possible. Margin exchange functionality is the next step in this journey.</p><p><strong>A Note on Decentralized Lending</strong></p><p>Decentralized lending is a necessary component of margin exchange, and thus we’ve created <a href="https://github.com/HydroProtocol/protocol/tree/feature/funding/contracts/funding"><em>hydro-pool</em></a>, a decentralized lending framework optimized for empowering margin trading.</p><p>At this time, it is not our plan to compete in the generalized lending space. Our sole focus is to make DDEX the number one decentralized <strong>exchange</strong> platform. Lending-based metrics don’t matter to us.</p><p>This stance is beneficial because it allows us to consider the possibility of leveraging external lending pools such as Compound Protocol or Dharma. We are excited about the prospect of improving liquidity via cascading lending pools.</p><p><strong>Coming to Hydro SDK</strong></p><p>If you are interested in creating your own decentralized lending and margin exchange, all the aforementioned functionalities are coming to <a href="https://github.com/HydroProtocol">Hydro SDK</a> later this year.</p><h3>Learn More</h3><p>DDEX is scheduled to launch our open beta by the second week of August 2019. You can signup for early access at <a href="https://margin.ddex.io/">https://margin.ddex.io</a></p><p>In the mean time check out our FAQ and come <a href="https://discord.gg/g6C6jfB">chat</a> with us.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f98f87a61079" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/decentralized-margin-trading-and-lending-is-coming-to-ddex-f98f87a61079">Decentralized Margin Trading and Lending is coming to DDEX</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DDEX FAQ: Margin Trading]]></title>
            <link>https://medium.com/hydro-protocol/ddex-faq-margin-trading-bd4b32beb9f?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/bd4b32beb9f</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[decentralization]]></category>
            <category><![CDATA[decentralized-exchange]]></category>
            <dc:creator><![CDATA[Scott Winges]]></dc:creator>
            <pubDate>Mon, 22 Jul 2019 21:18:26 GMT</pubDate>
            <atom:updated>2019-07-22T21:18:26.503Z</atom:updated>
            <content:encoded><![CDATA[<p>We just announced that a vastly improved <a href="https://margin.ddex.io/">DDEX with Margin Trading and Lending</a> is coming soon. This FAQ dives into some of the key details and logic behind the new platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1JXajYEni3rkw3naySKG6Q.png" /></figure><h3>Getting Started</h3><h4>When will the new DDEX launch?</h4><p>We will officially launch the new DDEX on mainnet by the second week of August.</p><p>Towards the end of July we will release a testnet version for users to play around with. Our closed alpha will follow shortly after.</p><h4>What all can I do on the new DDEX?</h4><p>There are three primary things you can do on DDEX:</p><ul><li>Margin trade</li><li>Spot trade</li><li>Lend to earn interest</li></ul><h4>Is it secure?</h4><p>We work extremely hard to secure all aspects of DDEX. We also have all of our smart contracts professionally audited.</p><p>From the ground up we’ve designed DDEX to be as robust as possible: from price oracles, to liquidation mechanisms, to the underlying smart contracts.</p><h4>Who can use DDEX?</h4><p>When we launch next month, DDEX will be available for everyone. There is no account creation process, nor are there any planned restrictions to our users at this time.</p><h3>Lending and Borrowing</h3><h4>How are interest rates set?</h4><p>The interest rates on DDEX are set algorithmically based on supply and demand. Lending and borrowing is done through the use of decentralized lending pools, where lenders pool assets into a smart contract and borrowers take loans from this pool (secured by collateral). As such, these interest rates are dynamic, and fluctuate when supply and demand changes. Each asset will have a unique interest rate for lending and borrowing.</p><p>If the pool has a large amount of assets deposited with little borrowing, the interest rates will be low. As borrowing demand increases, the interest rates will increase: both the cost for borrowers and the return for lenders.</p><h4>Can I use my borrowed assets outside of DDEX?</h4><p>The quick answer is no. The borrowing on DDEX is primarily designed to support margin trading done internally on DDEX. Because we keep the borrowed assets within DDEX, the potential leverage rates on DDEX are higher than if you were to try and manually take a loan on one platform and use those borrowed assets on another.</p><p>Although we don’t support an external withdrawal on a product level, we actually do support this on a contract level. The Hydro Protocol smart contracts actually do support the ability to move some borrowed assets outside of DDEX. A user could manually construct a transaction to move borrowed assets outside of DDEX, but they would only be able to withdraw a small portion of their maximum available borrowed assets.</p><h4>What does DDEX use to determine prices?</h4><p>DDEX uses on-chain price oracles to determine real-time USD prices, which are critical for determining the value of collateral for a given account. These price oracles are different for each market <em>(example: the ETH-DAI market will use the MakerDAO ETH-USD price oracle), chosen based on stability</em>. Additionally, we have several safety mechanisms built into the price determination process to guard against oracle failures: both on a contract level and algorithmically.</p><p>With that being said, other platforms have already demonstrated some of the <a href="https://blog.synthetix.io/response-to-oracle-incident/">complications that can occur when a price oracle fails</a>. While we have extra safety mechanisms in place to help the oracles be as robust as possible, we also want to make sure that there is a reliable backup option.</p><p>Price oracles and liquidation methodology together provide a strong metric for platform security. As both a lender and borrower, it’s imperative that these function properly.</p><h4>How do liquidations work on DDEX?</h4><p>Liquidations on DDEX are triggered by a 3rd party initiator. When initiated, our smart contracts will check to see if the flagged address is qualified for liquidation<em> (i.e. their collateral rate is below the respective threshold for that market)</em>. If it is not below the threshold, nothing happens. If it is, a liquidation event is triggered.</p><p>DDEX uses a form of dutch auctions for liquidation events. The dutch auction attempts to sell the borrower’s collateral to repay their debt. However, it doesn’t just start with selling the entire collateral — initially, only a small percentage of the collateral is offered up for auction. As time passes, each subsequent block offers a bit more of the collateral.</p><p>Eventually the value of the percentage of collateral offered will make a profitable trade for outsiders. If the auction is completed before 100% of the collateral is used, the remaining collateral will be returned to the borrower, with a small amount going to the initiator as a reward.</p><p>By performing liquidations in this method, even if a price oracle were to fail and a position got liquidated prematurely, the losses for the borrower would be minimized. <em>The borrower effectively has an additional layer of protection from price oracle failures through our dutch auction liquidation method.</em></p><h4>Is lending risk free?</h4><p>One concern with lending is the potential scenario where the borrower’s collateral becomes less valuable than their borrowed assets. This scenario could result in a loss for the lending pool, depending on how the liquidation process works.</p><p>We researched existing decentralized lending platforms extensively in coming up with robust lending solution on DDEX. Because of the liquidation method described above, liquidations are triggered when the collateral is still worth more than the borrowed amount. As such, the losses for the lending pool could only occur if the price of the collateral dropped below the borrowed amount so quickly that in the time it took to increment the auction, the price of the collateral was now less than the borrowed amount. This is a super rare event that we don’t expect to happen, but just in case we have another line of defense.</p><p>A percentage of interest gets sent to an insurance pool, to help avoid losses for the lending pool. In the case where the borrowed amount became less than the collateral, the auction could increment the collateral beyond 100% and tap into the insurance pool to provide additional incentive for this collateral to be purchased in the auction.</p><h3>Spot Trading and Margin Trading</h3><h4>What’s the max leverage rate DDEX supports?</h4><p>For the initial release we have conservatively capped the maximum leverage rate at 5x. However, our decentralized margin trading architecture supports leverage rates over 10x.</p><p>In general, the practical leverage rate depends on the liquidity of the market. More liquidity = higher potential leverage.</p><h4>How do you determine the liquidation price?</h4><p>The liquidation price is calculated from the minimum allowable collateral rate for each market. This minimum allowable collateral rate is specified by market in our smart contracts. Initially, we will have a minimum collateral rate of approximately 110% for our starting markets.</p><blockquote>Let’s run through a quick example. Let’s say I opened a:<br>4x long on ETH-DAI with 1 ETH of collateral;<br>Open price of 300DAI/ETH;<br>This yields a 4 ETH position with 900 DAI of debt.</blockquote><blockquote>My collateral rate is my total amount divided by my borrowed amount. <br>So initially CR=(4ETH*300DAI/ETH)/900DAI=133%.<br>If our minimum allowable collateral rate was 110%, we could calculate the price at which this rate would trigger (the liquidation price).<br>Liquidation price = 110%*900/4 → 247.50 DAI</blockquote><h4>Can I adjust my position once it is open?</h4><p>Yes you can adjust existing positions!</p><p>At a product level we generally try to optimize for the most common scenario: we make it super easy to simply open and close your entire position. However, the contracts are extremely flexible so we decided to allow users to make arbitrary adjustments to their position if desired.</p><p>You can close part of an open position, add collateral, and add additional leverage as desired.</p><h4>What types of collateral can I use to open a position on a market?</h4><p>You can use either the base or quote token of that market as collateral for opening a position. So if I wanted to open a position on ETH-DAI, I could use either ETH or DAI for the position.</p><h4>Can I make Limit Orders on Margin?</h4><p>Yes, you can make leveraged limit orders on DDEX!</p><p>The standard Margin order is set as a market order, but you can change this to limit orders as desired.</p><h4>Can I make stop-loss orders?</h4><p>Yes, you can make stop-loss orders on DDEX!</p><p>This is one awesome advantage we have by using our own DEX instead of a third party one: we can naturally incorporate stop-loss orders into DDEX.</p><h4>Is DDEX fully on-chain?</h4><p>DDEX uses a hybrid model decentralized exchange, with off-chain matching and on-chain settlement. It does not require gas to create or cancel orders, but all token transfers are still processed on-chain.</p><p>This is a more friendly structure for market makers, and is designed to promote excellent liquidity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd4b32beb9f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/ddex-faq-margin-trading-bd4b32beb9f">DDEX FAQ: Margin Trading</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What happened with the 0x contract exploit?]]></title>
            <link>https://medium.com/hydro-protocol/what-happened-with-the-0x-contract-exploit-23f5b11e7895?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/23f5b11e7895</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[exchange]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[0xproject]]></category>
            <category><![CDATA[decentralization]]></category>
            <dc:creator><![CDATA[Scott Winges]]></dc:creator>
            <pubDate>Mon, 15 Jul 2019 16:06:28 GMT</pubDate>
            <atom:updated>2019-07-15T16:32:47.154Z</atom:updated>
            <content:encoded><![CDATA[<h4>Breaking down the 0x Exchange v2.0 contract exploit, and why Hydro Protocol is not affected by this type of exploit</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N2QJvQ0dfY2yjtWRjjRI_g.png" /></figure><p>On the evening of July 12, 2019, <a href="https://blog.0xproject.com/shut-down-of-0x-exchange-v2-0-contract-and-migration-to-patched-version-6185097a1f39">0x announced</a> that there was a potential exploit in their 0x v2.0 Exchange contract. They immediately shut down their v2.0 Exchange contracts to prevent funds from being lost.</p><p>Since the initial Hydro Protocol smart contracts were <a href="https://medium.com/hydro-protocol/why-we-are-forking-0x-97dc48ee0426">inspired by 0x</a>, we were subsequently contacted by concerned users and developers wondering if we were susceptible to similar exploits. Fortunately, <strong>Hydro Protocol is NOT affected by this type of exploit.</strong></p><p>This article summarizes the context of the 0x exploit, why Hydro is not affected, and some lessons learned from the potentially catastrophic exploit.</p><h3>What exactly was the 0x exploit?</h3><p>The exploit revolved around a novel signature method introduced in 0x 2.0 called WalletSignature. In theory, this new signature scheme unlocks potentially new exchange use-cases between smart contracts.</p><p>The logic was missing a check to see if the account is a normal account or a smart contract. The missing logic combined with peculiarities of the EVM makes it possible to forge valid signatures for arbitrary 0x orders.</p><p>A hacker could have used this exploit to forge lopsided orders and <strong>drain all approved token allowances from every Ethereum address </strong>that had given approval permissions to the 0x v 2.0 contract.</p><h3>Why is Hydro not affected by this exploit?</h3><p>Although Hydro Protocol was inspired the 0x architecture, we were very diligent in taking the <strong>minimal amount of features necessary</strong> to build a first class decentralized exchange.</p><p>In our opinion, the WalletSignature module wasn’t useful to relayers in practice, therefore it was not included in the feature set of Hydro Protocol.</p><p>Furthermore, although we borrowed some ideas from the 0x repository, we <strong>rewrote, tested, and audited every single line of code from scratch</strong>.</p><h3>Lessons Learned</h3><p><strong>Trust-less forking</strong></p><p>0x’s nightmare scenario was prevented because samczsun was kind enough to notify the team in private. Unfortunately, this act of kindness was not carried forward. As soon as 0x patched the issue, they made the knowledge public. Although this was probably a case of oversight rather than malice, the result could have been catastrophic if anyone had carelessly forked over the code that contained the vulnerability.</p><p>At the end of the day, it is our sole responsibility to take full ownership and responsibility of every line of code we deploy.</p><p><strong>Viability of Proxy Contracts</strong></p><p>Smart contracts are immutable, meaning once they are deployed they cannot be changed.</p><p>The proxy pattern is an attempt to circumvent this “limitation”. The idea is that if you make users interact with the core logic(exchange) through a proxy, the exchange can be upgraded without the user having to know. Furthermore, the proxy pattern allows contracts to retain on-chain state during upgrades.</p><p>However, in the scramble to patch 0x 2.1, a completely new proxy was deployed, forcing all 0x relayers to upgrade and discard all on-chain state.</p><p>In contrast, most other DeFi projects don’t use such a proxy. For example, when Compound released their 2.0 upgrade, they simply deployed brand new contracts and asked users to manually migrate.</p><p>Moving forward, Hydro Protocol will reevaluate the worth of asset proxies. More to come on this.</p><p><strong>Even Top Engineers and Auditors are Only Human</strong></p><p>The 0x contract was audited by multiple professional teams of the highest caliber. Prior to creating Hydro Protocol, we spent time and money for both internal and external audits of key portions of the 0x code-base. In the end, everyone missed it.</p><p>The postmortems on the web are mostly focused on the specific technicalities of the exploit: solidity assembly, signature schemes, and external contact calls. These are important lessons to carry forward. But the biggest lesson for us is that everyone is fallible. The best way to minimize mistakes is to ruthlessly cutaway frivolous features and keep things simple.</p><h3>Thanks for reading!</h3><p>Hope this helped shine some light on this exploit, and provides some lessons for upcoming decentralized products. Let us know if you have any questions or feedback, we’d love to hear from you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23f5b11e7895" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/what-happened-with-the-0x-contract-exploit-23f5b11e7895">What happened with the 0x contract exploit?</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DeFi 101. Part 2— Margin Trading]]></title>
            <link>https://medium.com/hydro-protocol/defi-101-part-2-margin-trading-2b50d076deab?source=rss----beb761129c95---4</link>
            <guid isPermaLink="false">https://medium.com/p/2b50d076deab</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[exchange]]></category>
            <category><![CDATA[decentralized]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[defi]]></category>
            <dc:creator><![CDATA[Scott Winges]]></dc:creator>
            <pubDate>Tue, 02 Jul 2019 13:01:01 GMT</pubDate>
            <atom:updated>2020-01-21T05:48:50.038Z</atom:updated>
            <content:encoded><![CDATA[<h4>A 3-part series on decentralized lending, margin trading, and spot trading</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GWnuuEOtJLU0GvLcpbTAeg.png" /><figcaption>Missed part 1? <a href="https://medium.com/hydro-protocol/defi-101-part-1-lending-and-borrowing-15b4c9eef9d8">Check it out!</a></figcaption></figure><p>In <a href="https://medium.com/hydro-protocol/defi-101-part-1-lending-and-borrowing-15b4c9eef9d8">part 1</a>, we discussed how decentralized lending and borrowing works. To quickly summarize: decentralized loans are secured through the use of collateral, deposited by the borrower. As long as a loan is over-collateralized <em>(the collateral is worth more than the borrowed assets)</em>, the loan stays open. If the loan becomes under-collateralized, the collateral can be liquidated<em> (sold to payback the loan)</em> by the lending platform.</p><p>As of now, the primary use for borrowing crypto assets is Margin Trading. <strong>Decentralized Margin Trading cannot happen without the ability to take loans trustlessly!</strong></p><p>Building on part 1, in this article we will dive into how Margin Trading leverages loans to create positions: amplifying gains/losses and creating the ability to “short” markets.</p><p><em>Disclaimer: this series of articles is designed to be educational and informative. It is NOT investment advice. It is not an attempt to sway you into Margin Trading, nor do I assume any liability for your trades :) All trading, especially on margin, is inherently risky: please be careful and do your own research and due diligence!</em></p><h3>Part 2 — Decentralized Margin Trading</h3><h4>What is Margin Trading?</h4><p>The term <strong>Margin</strong> refers to <strong>borrowed assets</strong>. <strong>Margin Trading</strong> is thus the process of <strong>trading</strong> <strong>borrowed assets.</strong></p><p>When you trade on margin, you are “taking a position” on a given market.</p><h4>Why do people trade on Margin?</h4><p>Margin trading amplifies your gains or losses. By borrowing funds and then trading them, you can leverage a position on a market: a 2x leverage would double my gains or losses, 3x would triple them, etc. The ability to margin trade <strong>allows traders to actualize greater returns without investing additional money into a particular asset</strong>.</p><p>Margin Trading also opens up an entirely new type of trading that is not possible with spot trading: the ability to bet on the decline of an asset’s price (called a “short”).</p><p>In the decentralized world, this can all be done trustlessly through the clever use of smart contracts, collateral management, and liquidations.</p><h4>What are positions?</h4><p>Your margin position is what you believe is going to happen in a given market: either LONG or SHORT. If I am LONG on ETH-DAI, I believe that the price of ETH is going to rise with respect to the price of DAI. If I’m SHORT on ETH-DAI, I believe that the price of ETH is going to decrease with respect to the price of DAI.</p><ul><li>Long means I think the price is going to go up</li><li>Short means I think the price is going to go down</li></ul><h4>An Example: Understanding Margin Trading</h4><p>Let’s go through our glorious Bob example once more.</p><p><em>Bob believes that the price of ETH is going to rise with respect to the price of DAI. Currently ETH is priced at 260 DAI. Bob only has 2 ETH though, and decides that he wants to leverage his position to make more gains!</em></p><p><em>So Bob deposits his 2 ETH as collateral, and takes out a 260 DAI loan at 10% APR. Bob then takes this 260 DAI loan to his favorite Decentralized Exchange and buys 1 ETH with it. Now Bob has 3 ETH (with a 260 DAI loan) — his position is now a 1.5x Leveraged Long on ETH-DAI.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*dVNxnn_2HLP2iBlwAJdBxg.png" /><figcaption>Bob borrowed 260 DAI, then traded it for 1 ETH</figcaption></figure><p><em>A couple months later, ETH’s price shoots up to 300 DAI and Bob decides he wants to close his position. To do this, Bob needs to repay his 260 DAI loan, plus ~5 DAI of interest. So Bob sells 265 DAI worth of ETH (~0.883 ETH) and repays his loan, closing out his position. Bob now has 2.117 ETH, valued at 635 DAI!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*JNSdKKWRGtT_wyuTX_iGbg.png" /><figcaption>Bob started with 2 ETH, and ended up with 2.117 ETH. Not only did the value of ETH rise, by going LONG on ETH-DAI he gained 115 DAI of value instead of only 80. He increased his gains by ~44%!</figcaption></figure><ul><li>To start, Bob had 2 ETH valued at 520 DAI</li><li>At the end, Bob had 2.117 ETH valued at 635 DAI → a 115 DAI gain</li><li>Without his position, he would have 2 ETH valued at 600 DAI → a 80 DAI gain</li><li>Bob gained an extra 35 DAI, or ~44%, value from his 1.5x long!</li></ul><p>This makes sense for all parties involved: the lenders are happy because they profit on interest, Bob is happy because he can leverage his positions, and the exchanges are happy because they’re getting extra trading volume.</p><p>While the example above is illustrative of how margin trading works, it doesn’t quite speak to the potential power and risk involved.</p><h4>Margin Trading Risks</h4><p>In Part 1 we discussed how a loan could get liquidized if the collateral rate got too low. This still applies to Margin Trading, though there are some additional nuances.</p><p>When you open a margin position, your position will display a <strong>call price</strong> (commonly called a liquidation price in decentralized circles) that is based on the collateral rate. This is the price at which your collateral is no longer valued high enough to be sold to reliably pay back your loan.</p><p>In Bob’s example above, if the price of ETH dropped below 130 DAI, Bob’s collateral of 2 ETH could no longer be sold to pay his 260 DAI loan back. Recall that in practice, the collateral rate (and thus the call price) is actually set with a built in safety margin to reliably pay the loans back. So with a 15% margin of safety, at the price of 149.5 DAI, Bob’s 2 ETH collateral would be sold to close out his position. Upon this liquidation, Bob would still hold onto his 1 ETH (from the 260 DAI he borrowed and traded), but he would lose access to his initial 2 ETH collateral.</p><p>The liquidation process for these loans varies heavily from platform to platform, and is an area of much nuance. Some hold what are referred to as dutch auctions, where outside participants watch like eager vultures to jump in on a tasty liquidation opportunity (the safety margin results in a unique arbitrage opportunity), while others atomically sell and repay the loans with a built in liquidation fee. Regardless of the mechanism, liquidation is a big risk for margin traders — amplifying your losses can be a painful process.</p><p><em>In part 3 I’ll discuss some more of the pros and cons of these different liquidation methods, along with their reliant price oracles.</em></p><h4>The Power of Trading on Margin</h4><p>While a 44% gain for Bob was nice, margin trading is often performed at significantly more aggressive leverage rates. Being able to actualize 500%+ of your profits (or losses!) is extremely powerful.</p><p>Platforms that allow for borrowing and trading in a single interface (many <a href="https://www.bitmex.com/">centralized</a> <a href="https://www.bitfinex.com/features#trading">exchanges</a>, and some recent decentralized <a href="https://dydx.exchange">projects</a>) can achieve leverage ratios much greater than 1.5x. If BOTH your loan and your collateral all stay on the same platform, extremely leveraged positions become possible.</p><p>Let’s break down why a platform needs access to both your collateral AND your borrowed assets in order to achieve higher leverage rates.</p><ul><li>On platforms that don’t have trading built in, you are allowed to freely take your borrowed assets off of their platform. If they don’t have any control over these borrowed assets, your collateral must be able to completely cover the loan at all times. Thus the maximum leverage ratio for these platforms can never be more than 2x (with safety margins typically only 1.5x is the max). <br><em>Note — there are some clever workarounds for this involving specialized tokens, but for simplicity we will forgo these for now</em></li><li>On platforms with trading built in, <strong>your borrowed assets stay in their system and can effectively be counted as part of your collateral</strong>. These platforms know exactly what your total account value is at anytime (collateral + borrowed amount). As long as the platform can use all of that to cover the initial loan (with a safety margin), your loan and position can stay open. Using this they can achieve leverage ratios far greater than 2x.</li></ul><p><em>In Bob’s example above, if he was able to open a 4x leveraged position he would have been able to borrow 1,560 DAI instead of 260 DAI with still just a 2 ETH deposit → yielding a final result of 294 DAI profit instead of 80 DAI, 368% additional value.</em></p><p>Greater leverage comes with greater risk: when you use your borrowed assets as additional collateral, liquidations happen quicker and are much more costly.</p><p><em>In Bob’s example of 1.5x leverage, he was using a platform that did not count his borrowed assets as collateral: even if ETH dropped and his collateral was liquidated, he would still at least keep his borrowed assets. However, in the 4x example, liquidation would wipe out everything Bob had: all of his borrowed assets and his collateral. Additionally, his call/liquidation price would have been ~224 instead of 149.5 — the price variance required to liquidate his position would be much less.</em></p><blockquote><strong>With great power comes great responsibility</strong></blockquote><h4>Next up, Spot Trading, Price Oracles, and Liquidations</h4><p>The only way that lending, borrowing, and margin trading can thrive is if you have the ability to trade borrowed assets on an open market. This is referred to as spot trading. In the context of DeFi, this is done on decentralized exchanges (DEX’s).</p><p>Part 3 is now live! <a href="https://medium.com/hydro-protocol/defi-101-part-3-spot-trading-price-oracles-and-liquidations-e215fc17b36d">https://medium.com/hydro-protocol/defi-101-part-3-spot-trading-price-oracles-and-liquidations-e215fc17b36d</a></p><p>Part 3 covers a few key details we’ve glossed over in parts 1 and 2 that are critical to upholding lending, borrowing, and margin trading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*T7C3cW8QplKP2q-Nsdl0sw.png" /><figcaption><a href="https://hydroprotocol.io">hydroprotocol.io</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b50d076deab" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hydro-protocol/defi-101-part-2-margin-trading-2b50d076deab">DeFi 101. Part 2— Margin Trading</a> was originally published in <a href="https://medium.com/hydro-protocol">Hydro Protocol</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>