USDC’s Depeg or: How I Learned to Stop Worrying and Trust the Bots

Riyad Carey
Kaiko
Published in
6 min readMar 16, 2023

--

While the market seems to have shrugged it off, crypto — and DeFi in particular — survived an existential risk over the weekend. USDC was caught up in the turmoil that hit U.S. banks and depegged amidst fears it was no longer fully backed. We covered the reaction in centralized markets in the week’s Debrief, but given that USDC’s primary use case is in DeFi, this week we’ll examine how the depegging played out on-chain, examining trading, liquidity, and lending and borrowing, with a particular focus on the role that bots played.

Trading

Not surprisingly, the day of the depeg was one of the highest volume days for DEXs ever. Swaps between USDT, USDC, and DAI exceeded $10bn on Curve and Uniswap V3 combined, with Curve taking a slight edge in volume at just under $6bn.

Curve maintained its lead on March 12; Uniswap V3 took top spot on March 13, with $1.5bn in volume to $1.3bn. Uniswap V2’s stablecoin-stablecoin volume also surged, though it reached just $40mn on March 11.

This flurry of activity created plentiful opportunities for arbitrage. Zooming in on the hours leading up to USDC’s depeg, Curve and Uniswap V3’s USDC-USDT price follows the same general trend with some differences.

Uniswap V3 allows for the creation of multiple pools for the same pair of assets, each with a different fee, giving liquidity providers (LPs) greater control over their risk and reward. This also has the effect of creating slight divergences in prices across pools: many of the trades that executed at worse prices were being routed through the USDC-USDT 0.05% fee pool, while the trades with better execution went through the 0.01% fee pool. Curve swaps did not exhibit this kind of divergence because USDC-USDT trades were routed through one pool: the 3pool.

The second order effect of the different prices between Uniswap V3 pools is that it creates opportunities for arbitrage (which can boost volumes significantly). Below is charted every USDC-USDT swap on Uniswap V2, V3, and Curve during the depeg.

Uniswap V2 moves in a uniform fashion, sticking closely to the line dictated by its AMM formula. There are few outliers except for an unfortunate user who was the victim of a sandwich attack and swapped 50,000 USDC for 30,549 USDT, a price of just $0.61, which seems to be the lowest registered anywhere on- or off-chain. Curve, too, has few outliers as it followed its AMM formula. Meanwhile, Uniswap V3 has numerous outliers and a wide spread — including swaps at a price of $1 while USDC was depegged everywhere else — as bots performed complex transactions to arbitrage between pools.

Liquidity

As expected, the dramatic volatility brought with it just-in-time (JIT) liquidity. From March 10–14 the top address by liquidity event (mints and burns) volume churned through nearly $1.5bn in just 104 transactions. This was nearly double the next most prolific user, who clocked $815mn in 75 transactions. In a sign of how cutthroat and ethereal JIT provision can be, the user who was in first (by a mile) when I wrote my article just over a month ago is no longer active; the user who was in 10th place has moved up to 3rd; and there are 6 new users in the top 10.

JIT liquidity still remains mostly isolated to the ETH-USDC 0.05% pool. Despite significant volumes, there was no evidence of any significant JIT liquidity in the other ETH-USDC pools or any USDC-USDT pools. In the case of these pools, it’s likely that the smaller 0.01% swap fee makes it too difficult for JIT providers to turn a profit.

Meanwhile, the 3pool shrunk from $525mn to under $400mn in a few hours as USDC’s price slumped and users pulled their liquidity. 958 of the 1,416 of users that interacted with the pool between March 10 and 14 only completed one transaction.

The top address by transaction count was submitting extremely complex transactionsthat utilized the 3pool to arbitrage across Uniswap V3, though these transactions were much smaller than JIT transactions.

Lending and Borrowing

There was also significant bot activity on lending and borrowing protocols, particularly Aave. One contract was responsible for over $20bn worth of deposits and withdrawals, using flashloans to arbitrage a variety of pools, again including the 3pool and Uniswap V2 pools.

Lending and borrowing protocols also provided some insight on how users were reacting to USDC’s depegging. The supply rate for USDC began to increase as its peg shook after users disproportionately borrowed/removed the stablecoin. Borrowers sought to short USDC while suppliers removed it from the protocol, likely to swap to a different token.

Just before USDC’s price bottomed, the USDC supply rate on Aave topped out at over 2% before falling back to 1% as loans were repaid. Meanwhile, DAI’s rate tumbled below 0.5% as it depegged and users were able to repay loans at a discount.

DAI’s rate decrease compared to USDC’s increase is confounding considering they had both depegged, but the story becomes clearer when looking at the hourly activity (with flash loans removed to better see flows). In the selected time period as both were depegging, $535mn DAI was deposited compared to just over $225mn borrowed. Meanwhile $621mn USDC was deposited, $1bn borrowed, $1.12bn repaid, and $752mn withdrawn.

USDC repayments were evenly spaced by hour, lending credence to the idea that users were taking advantage of cheap USDC to repay their loans at a discount.

The supply rates of unaffected stablecoins surged as users rushed to borrow them. While we don’t know the end goal of users borrowing these stables, an effective trade would have been to deposit collateral (probably ETH), borrow USDT, buy USDC at a discount with the USDT and wait for USDC’s price to return to the peg.

Conclusion

This weekend was downright scary as it appeared that USDC’s fate — and thus the fate of DeFi and crypto — hung in the balance. Luckily, this doesn’t affect bots, who did their job of maintaining consistent prices throughout the depegging, making some technical wizards remarkable sums of money and creating unusual and interesting data points in the process.

Many times while writing this I came across data and thought “there’s just no way that’s right” only to dig deeper and discover a transaction that I had never seen before. Ethereum grows more complex by the day; new protocols are constantly being built and existing protocols are used in novel ways by bots competing to arbitrage and provide liquidity. This maze of transactions is overwhelming; without clean and accurate data market participants are flying blind.

--

--