<?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[Stories by Mario Romero Zavala on Medium]]></title>
        <description><![CDATA[Stories by Mario Romero Zavala on Medium]]></description>
        <link>https://medium.com/@mariorz?source=rss-912bf1edd988------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0AAiGJUedfPGmhTgUPKZ7g.jpeg</url>
            <title>Stories by Mario Romero Zavala on Medium</title>
            <link>https://medium.com/@mariorz?source=rss-912bf1edd988------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 08:50:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mariorz/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The greatest liquidation in the history of DeFi: The case of the Liquidated Looper Whale]]></title>
            <link>https://mariorz.medium.com/the-greatest-liquidation-in-the-history-of-defi-the-case-of-the-liquidated-looper-whale-1970cea1aa0b?source=rss-912bf1edd988------2</link>
            <guid isPermaLink="false">https://medium.com/p/1970cea1aa0b</guid>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[compound-finance]]></category>
            <category><![CDATA[flash-loan]]></category>
            <dc:creator><![CDATA[Mario Romero Zavala]]></dc:creator>
            <pubDate>Sun, 20 Dec 2020 17:22:11 GMT</pubDate>
            <atom:updated>2021-01-03T19:32:01.940Z</atom:updated>
            <content:encoded><![CDATA[<h3>The greatest liquidation in the history of DeFi</h3><h4>The case of the Liquidated Looper Whale</h4><p>On the early morning of November 26th, at about 08:55 AM UTC, Ethereum account <a href="https://etherscan.io/address/0xe8468f05550563aa5bfc5fbcb344bf87aa2f6b84"><em>0xe84</em></a>, a contract controlled by <a href="https://etherscan.io/address/0x945e6743663de47ac5cf7985c46bd41119b025e6"><em>0x945e</em></a><em> (the liquidator)</em>, took a Uniswap flash loan for <strong><em>46,090,379.94 DAI</em></strong> and used it to perform a <a href="https://etherscan.io/tx/0x53e09adb77d1e3ea593c933a85bd4472371e03da12e3fec853b5bc7fac50f3e4">liquidation for a Compound loan</a> from account <a href="https://etherscan.io/address/0x909b443761bbd7fbb876ecde71a37e1433f6af6f">0x909b</a>, the Liquidated Looper Whale. The liquidator reaped with this transaction an impressive 3.7M DAI bounty, from the 8% liquidation incentive the Compound protocol awards to liquidators, and grabbed with this a spot in the incipient history books of DeFi as the <em>single biggest liquidation performed to date</em>. What follows is the story of that liquidation.</p><figure><img alt="History of Compound Liquidations across all assets" src="https://cdn-images-1.medium.com/max/884/1*hHKDi5CTcMvxryyLSE0pJQ.png" /><figcaption>History of Compound liquidations across all assets. The liquidation in question in red.</figcaption></figure><h3>The Liquidated Looper Whale</h3><p>We begin this story with the case of the Liquidated Looper Whale in June of 2020 with the launch of the Compound incentives or “liquidity mining” program. This program awards COMP in equal proportion to lenders and borrowers of the protocol based on the amount of capital supplied or borrowed. LLW is not the only whale of its kind, more than a few other whales like it roam the Compound contracts, some even considerably larger, in an activity known within the realm of DeFi as <em>“farming”</em>. The strategy applied by these accounts consists in depositing assets, most commonly DAI, then by interacting directly with the Compound contracts taking out a loan for close to 75% of their deposit, which is the maximum amount possible, given Compound’s 0.75 “collateral factor” for DAI, a loan which they then deposit back into Compound to then take out another loan and repeat the process a few more times in a series of looping “wash loans” that result in leveraging up their supplied and borrowed values within the protocol. This is done with the purpose of increasing their share of the allocated COMP rewards meant to incentivize protocol usage and, ideally, distribute the COMP governance tokens to the protocols’ users. LLW during the months up to the morning of November 26 gradually increased the capital invested into its strategy, reaching a maximum of about $126,390,000 USD in supplied stablecoins, and $93,726,512 DAI borrowed, or $32M USD of actual value deposited into the Compound contracts before the tragic morning of <a href="https://www.comp.xyz/t/dai-liquidation-event/642">the event</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*4HIY1aJwHegcKc06308JDg.png" /><figcaption>History of LLW within the Compound protocol</figcaption></figure><p>During its agricultural career within Compound, and up to the night of November 24th, on block 11321862 to be precise, LLW had farmed and claimed 17,073 COMP in rewards, or around $2,643,400 USD of value at the current COMP price of $153 USD. However, LLW is not a COMP holder and in an automated fashion would claim and transfer out COMP to its Coinbase account and to Uniswap for a total value of closer to 2.16M considering historic daily COMP prices.</p><p>If we aggregate the accounts to which LLW transferred out its claimed COMP by amount sent, we get the following distribution:</p><pre><a href="https://etherscan.io/address/0x0f71DCff39Ab3A817d02b6b3b808FFA21d3f67c1">0x0f71DCff39Ab3A817d02b6b3b808FFA21d3f67c1</a>: 8373.420 <a href="https://etherscan.io/address/0xd578653Be7CC96d254CeBC45151Fa8f193d6263B">0xd578653Be7CC96d254CeBC45151Fa8f193d6263B</a>: 7492.15<br><a href="https://etherscan.io/address/0xCFfDdeD873554F362Ac02f8Fb1f02E5ada10516f">0xCFfDdeD873554F362Ac02f8Fb1f02E5ada10516f</a>: 2149.98</pre><pre>And 707.3 to five other accounts</pre><p>With the help of the amazing <a href="https://nansen.ai/">Nansen</a>, we can identify the first two accounts as Coinbase, the first one in current use, and the second one stopped being used for deposits some 70 days ago. Only 1 account aside from LLW has ever deposited to these Coinbase accounts. The other account making deposits is one to which LLW sent the USDC it had left as collateral in Compound after the liquidation event. We will dig more into this later. But it is safe to assume both these accounts are controlled by LLW. The third account to which LLW sent most of the rest of its claimed COMP was the Uniswap COMP/WETH pool in order to exchange the COMP for WETH.</p><p>The frequency in which LLW claimed and transferred out the COMP rewards is worth pondering for a minute. Between block <strong>10,272,415</strong> and block <strong>11,321,862</strong>, a period of 162 days, it performed 1191 calls to Compound contracts that resulted in COMP claims, or an average of 7 claims per day. The frequency at which LLW interacts with the COMP contracts keeping its account above the minimum health limit while maximizing leverage additionally results in an outstanding number of COMP claims, which also minimizes its exposure to COMP pricing changes. This is only possible given the scale of LLW, as your small local farmer would get buried by the gas costs incurred.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*r9qz5o_OYAlYFJlg9A-Wew.png" /><figcaption>Plot of LLW COMP claim transaction by number of blocks from previous claim</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*EcfsY_Lz8-keXUt5FrPTOQ.png" /><figcaption>Histogram of LLW COMP claims by number of blocks from previous claims</figcaption></figure><h3>How much money was this whale really making anyway?</h3><p>Calculating the PnL for LLW’s strategy up the fatal day of <em>the event </em>involves considering, in addition to the profit from the COMP claimed and dumped, the total cost of gas transactions and the total interest paid from the Compound loans, minus the interest accrued from the collateral deposited.</p><h4>PnL = COMP value claimed - Gas costs - Compound interest paid + Compound interest accrued</h4><p>As mentioned above, LLW was able to make $2.16M USD from COMP claimed and sold during its farming period.</p><p>In interests up to November 24th, LLW had paid a net total value of $85,732 in stablecoins. This is including a positive accrued interest amount of $50,671 from a portion of its deposits in USDC.</p><p>Gas costs for this farming operation come from two types of transactions:</p><ol><li>Interaction with the Compound contracts. These are mint, redeems, repayments, and borrows, which additionally result in COMP claims. LLW has made in total 922 transactions for these contract calls, which added up to 33.29 ETH in gas, with a current ETH price of $650 USD that adds up to $21,638 USD value. In reality the cost is considerably less since ETH has had a nice ramp up since June when LLW first started farming</li><li>Transfers out to exchanges for COMP selling. There are 188 COMP transfers in total to the above identified Coinbase and Uniswap addresses. For which a total of 1.33 ETH was paid as gas, or around $864 at current ETH price of $650</li></ol><p>This all adds up to a total 34.63 ETH in gas costs, or $22,509 USD at the current $650 ETH price. Again, the actual USD cost would have been lower given the ramp up in ETH price during the second half of 2020. (🚀)</p><p>So the PnL before its liquidations was somewhere around: <br><em>$2.16M - $85,732– $22,509.5 </em><strong><em>= $</em>2,051,758.24 <em>USD</em></strong></p><h3>A Looper Whale’s APY</h3><p>Calculating the APY can get a little tricky given that it is impacted by different factors, not only the amount of capital LLW had deployed into this strategy at any given point, which varied considerably in a ramp up during the months of its farming career prior to the event. But also by the amount of rewards allocated for LLW’s account from the COMP incentives distribution program, which will depend as well on other capital that is flowing within the system, and the price of COMP itself. We can however make a reasonable approximation by focusing on the two weeks from October 6 to October 20, for which LLW maintained its assets in Compound relatively stable at $115M USD of collateral value and $85M of outstanding borrows, which means a real investment of $30M in the farming strategy.<br>In those 14 days LLW claimed and sold a total of 2,472 COMP, or around 176.57 COMP per day. With an average COMP price of $158 USD for that period, we get a daily income of around $27,800 USD. If we could extrapolate this for the entire year we would get a yearly income of $10,147,000 assuming around 5% of gas and interest costs, as described above, we get around $9,639,650 for a very not unimpressive APY of around 32%. Pretty good for a mostly market neutral strategy.</p><h3>The November 18th movements</h3><p>Before moving on from LLW, it is interesting to zoom into its activity on November 18th, between blocks 11,282,800 and 11,283,600.<br>For reasons I can’t explain, LLW started the day by unwinding its DAI loans and collateral, and moving the same recursively leveraged position to USDC instead. It then however reverted mostly all of it back before the end of the day, unwinding the USDC loans and collateral an looping back into DAI again. However, for some reason, it decided to leave around 16M USDC as collateral. This would prove to be a costly decision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*P2qOL7sAAjKQI8DHfihaDg.png" /><figcaption>One strange day</figcaption></figure><p>In part 2 and part 3 we will dive into the story of the liquidator and the liquidation itself.</p><p>Follow me on Twitter <a href="http://twitter.com/mariorz">here</a>.</p><p><em>You can generate Compound history charts like the ones above for any account using </em><a href="https://mariorz.github.io/compcharts/">https://mariorz.github.io/compcharts/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1970cea1aa0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Presentando Bitso API (v3)]]></title>
            <link>https://mariorz.medium.com/presentando-bitso-api-v3-e78beff0888?source=rss-912bf1edd988------2</link>
            <guid isPermaLink="false">https://medium.com/p/e78beff0888</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[bitso]]></category>
            <category><![CDATA[bitcoin]]></category>
            <dc:creator><![CDATA[Mario Romero Zavala]]></dc:creator>
            <pubDate>Mon, 30 Jan 2017 22:19:46 GMT</pubDate>
            <atom:updated>2017-01-30T22:19:46.833Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*khydF02hB6Bt9pkMChHltw.jpeg" /></figure><p>Las divisas digitales son dinero programable. Cuando pensamos en Bitcoin, es fácil enfocarnos en la especulación alrededor de su precio. Pero es bastante limitado pensar solamente en esta tecnología como activos para acumular en espera de alguna apreciación. A muchos, lo que nos parece más interesante, es que son plataformas programables, universales, y abiertas. La combinación de estos tres atributos puede fundamentalmente incrementar el acceso y reducir los costos de brindar servicios financieros en México y el mundo.</p><p>Bitso es una especie de puente entre esta nueva economía y la economía tradicional. Desde esta perspectiva, es importante que nuestros sistemas también tengan interfaces abiertas y programables.</p><p>En los últimos meses, en Bitso hemos estado trabajando en el diseño e implementación de la versión 3 de nuestro API. Esta nueva versión en realidad está conformada por cinco APIs, que juntas exponen un sistema completamente programable:</p><ul><li><strong>REST API</strong>: Un set de endpoints que permite solicitar información pública del estado actual de los libros de órdenes, así como solicitar información privada, o realizar cualquier operación relevante al manejo de una cuenta Bitso: conocer tu balance, historial de transacciones, realizar transferencias en cualquier moneda: (mxn, btc, eth). Vale la pena notar que desde el nivel de abstracción de esta API, el Sistema de Pagos Electrónico Interbancario (SPEI), Bitcoin, y Ethereum, son tres redes equivalentes para hacer transferencias, cada una con su respectiva moneda.</li><li><strong>WebSocket API</strong>: Este API permite mantener una conexión persistente a los servidores de Bitso para ser notificado al instante que ocurre cualquier cambio a los libros de órdenes. Si estás pensando en programar agentes para hacer trading automatizado, este API es para ti.</li><li><strong>Transfer API: </strong>Permite hacer una transacciones de Bitcoin, en cualquier parte del mundo, a Moneda nacional (MXN) con depósitos en cualquiera de los <em>outlets</em> disponibles, como pueden ser cuentas de banco, tarjetas de débito, vouchers, entre otros. Utilizando el precio y liquidez del mercado al momento, con esta API puedes obtener la cantidad de BTC necesario para recibir una cantidad determinada de pesos en una cuenta de banco nacional. Bitso se encarga de garantizar la cotización al hacer el intercambio a pesos, y posteriormente a hacer el envío mediante SPEI a la cuenta indicada.</li><li><strong>Account Creation API: </strong>Permite automatizar la creación de cuentas en Bitso que pueden ser administradas por la cuenta original. Vale recalcar que las cuentas creadas mediante este API se sujetan a las mismas políticas de verificación que cualquier otra cuenta.</li><li><strong>Webhooks: </strong>Permite que registres un URL que será llamado con información de eventos específicos registrados sobre tu cuenta, como cuando recibes un depósito en cualquier moneda. Con Webhooks y el REST API puedes construir, entre otras cosas, soluciones de pago que acepten transferencias en diferentes divisas.</li></ul><p>He visto muchas APIs de exchanges en otros países, y me parece que aunque algunas pueden tener otras capacidades comparables, ninguna ofrece una integración tan completa como la nuestra. Estoy bastante emocionado por ver algunos de los usos posibles que hemos previsto, como pudieran ser proyectos para facilitar envíos de remesas, así como por los usos imprevistos que aún no hemos podido imaginar.</p><p>La documentación completa está disponible en el siguiente link: <a href="https://bitso.com/api_info">https://bitso.com/api_info</a></p><p>También publicamos una actualización a nuestras librerías, en Python y Java, que hemos estado usando internamente, y pudieran servir como referencia para implementar algo similar en otros lenguajes.</p><ul><li><a href="https://github.com/bitsoex/bitso-py">https://github.com/bitsoex/bitso-py</a></li><li><a href="https://github.com/bitsoex/bitso-java">https://github.com/bitsoex/bitso-java</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e78beff0888" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>