0xBeans Profile picture
Mar 22, 2022 19 tweets 6 min read Read on X
Gonna end the $APE content with 1 final thread. Let's dive into how this absolute fucking chad borrowed 5 bored apes, claimed $APE for all of them, returned the apes, and subsequently netted ~600k.

A story of how a bot looked for value where no one else did.
First we have to understand what flash loans are.

Flash loans are a DeFi concept that allow a contract to borrow large sums of money as long as the loan gets paid back within 1 txn.

If the loan isn't paid back in 1 txn, everything is reverted (as if nothing happened).
"How" this all happens in 1 txn is beyond the scope of this thread.

Typically flash loans are used for arbitrage, front running, etc. Here's an example of how you would use a flash loan if you detected an arbitrage opportunity.
Second, we have to understand what NFTX is. I personally haven't used NFTX but "NFTX is a platform for creating liquid markets for illiquid Non-Fungible Tokens (NFTs)".

Essentially its a protocol where you can lock up your NFT in a vault and receive liquid ERC20 tokens back.
For example, you can lock up your BAYC (erc721) in a vault and get 1 vBAYC token (erc20) back. You can redeem an ape from the vault by giving back your vBAYC.

Why does this protocol exist? Out of scope again but essentially gives liquidity (erc20) to non liquid assets (erc721)
So now knowing all this, let's dive into the bot txn.

First, bored ape #1060 was transferred to the bot contract. This ape wasn't borrowed but actually bought from OS. We'll see why the bot bought an ape later in this thread.

(English is hard... "bought" "bot" lmao)
Next, the bot gets a flash loan of 5.2 vBAYC tokens from the NFTX vault.
Next, the bot swaps out its vBAYC tokens for 5 actual apes (5 apes have been transferred to the bot).

Notice the first ape doesnt come from the NFTX vault (since thats the ape the bot actually bought). So by this point, the bot has 6 apes in its possession.
Next, the bot calls to the $APE airdrop contract and claims all the $APE for all 6 apes. Netting ~$600K.
Finally, the bot transfers the apes back to the NFTX vault to redeem back vBAYC tokens to repay the loan.
So why did the bot need to buy its own bored ape?

It's because flash loans have a fee attached to them. Whenever you get a flash loan, you must pay a fee in addition to the original loan.

So the bot swapped its own bored ape (#1060) for vBAYC to pay off the flash loan fee.
The funny thing is, the fee only took a portion of the vBAYC tokens the bot redeemed for its own ape.

Since the bot has no need for extra vBAYC tokens, it just swapped its remaining vBAYC for 14 ETH.
What I find beautiful is that I assume this bot didn't have much competition for this strategy (I may be wrong on this).

MEV is super competitive, it's extremely hard to write a profitable MEV bot to arbitrage/frontrun because so many big brains are in the space (bot vs bot).
However, if you just look at extracting value in a place that no one else is looking at, you win.

Quoting @bertcmiller "If you're thinking about these things or looking for them, which not many ppl are, there's a lot of value to be captured".
The cherry on top is that boy genius @_anishagnihotri wrote this EXACT same strategy that borrowed punks from NFTX to mint Meebits last year.
The sad thing about this whole story is that I read Anish's strategy, thought it was really clever, and completely forgot about it lmao.

Guess Im ngmi in MEV... not big brain enough.
Just because I KNOW Im gonna get a question about this. "Is this ethical and is ethereum doomed".

Whether it's ethical is up for you to decide, but this is an open and permission-less system which not only creates these adversarial environments, but also leads to innovation.
If you really wanted to, there are 1000s of resources online and you can participate it MEV right now - everything is open source. Try asking a hedge fund to let you in on their front running secrets :)

Idk about you but, web3 is the most exciting space in the world.
Whether you find anything ethical or not is your opinion, but I can't think of any other industry where so many big brains are playing in an open field for anyone to spectate or join.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with 0xBeans

0xBeans Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @0x_Beans

Mar 3
Ohm devs cooked something called Baseline that supposedly is infinite liquidity, no liquidation leverage, and up-only.

FYI I bought tokens but it's genuinely an interesting mechanism - NFA, it might go down + I have some improvements I would make.

Here's how it works: Image
First of all, there are 2 distinct products: Baseline is the protocol and $YES is the first token launched on top of Baseline.

We will go over how everything works.

Baseline effectively is an automated liquidity manager for tokens.
Baseline launches tokens on V3 AMMs with single sided liquidity - effectively 'ICOing' token launches initially.

quick recap, V3 has a concept of 'ticks', which are just liquidity ranges.

As people buy/sell the token (price discovery), fees are accumulated in a clever way.
Read 18 tweets
Nov 16, 2022
During dev con, I worked with @real_philogy and @yush_g to create what we think is a true blind vickery auction, fully on-chain.

This implementation is just a proof of concept but we think it could be a powerful primitive going forward for all auctions in the future. Image
Before we dive in, major props to @real_philogy and @yush_g for coming up with the initial approach and mechanic. Shoot em a follow, they're working on some real cool stuff.
First, what is a blind vickery auction and why is it better than the current auctions you see on Opensea or Nouns?

The problem with current 'non-blind' auctions is that all bids are public and this causes suboptimal price discovery. Image
Read 25 tweets
Oct 5, 2022
There's still some money to be made during the bear, so here's some bear market alpha.

Not sure if we'd even consider this long tail MEV but here's what @rauchp_ @wawrencelu and me have been doing to earn ~$700 a day *relatively* risk free and automated (since sept 28).
$700/day ain't a lot but considering the amount of work needed (only needed 2 simple boys), pretty worth. Take what you can get, just bear market tings 🤷‍♂️

This number will go down over the weeks but here's a tldr of it, similar opportunities will probs pop up every now and then.
We had no business looking at NEAR but @wawrencelu suggested we take a look to see if anything cool was happening.

We found a liquidity incentive program on @tonicdex. They were having a 50k USN (NEAR's stablecoin) incentive program for market makers on the USN/USDC pair.
Read 15 tweets
Jul 14, 2022
6 months ago, I approached the smartest friend I know and some of the best pixel artists in this space (imo) to create something unique.

We came up with @OfficialMirakai and after 6 months, it's finally minting in 2 hours.

I want to tell you some of the coolest parts.
First, there's a bunch of mechanics involved - deflationary items, changing rarities, token dripping, game theory, and re-rolling.

We had 3 main goals, create public goods, push the space forward, and create an interactive on-chain project. I think we succeeded at that.
There was one thing we didn't want to do - we didn't want the words 'coming soon' associated with Mirakai.

Every mechanic would work on mint date. IMO, I believe we have one the most intricate and built out projects from day 1.
Read 11 tweets
Jul 12, 2022
Just looked at the @WZRDSxyz contract and yep, they can definitely arbitrarily burn your NFT. It doesn't matter whether it's listed for sale or not, they can burn it (without paying you if it's listed).

They can also arbitrarily transfer your NFT to whoever as well.

Here's how: Image
Typically, when you try to transfer an NFT or a contract tries to transfer your NFT on your behalf, the NFT contract checks whether you're the owner of the token or if you gave explicit approval/permission to the contract trying to transfer your token. Image
This is why opensea asks you to send an approval transaction when you try to sell an NFT from a collection the first time. You're literally giving opensea permission to transfer your token to anyone if there is a sale.
Read 9 tweets
May 25, 2022
I get like 5-10 DMs a day asking about how to get better at solidity (some even ask if Im taking interns lol).

While this may be rudimentary and somewhat "obvious" knowledge, I'll try to explain the concept that really helped me "get it" when I first started learning.
When you interact with Ethereum, a majority of the time you're transferring some sort of token from your own wallet to another.

It's common to think "transferring a token" is an actual action of sending something to someone. ie the token is actually getting "sent".
However, it's much more simple than that.

There isn't actually "3 tokens" in your wallet, it's just a number (your balance) that represent how many tokens you should have.

So when you're 'sending' a token, it's just a simple increment/decrement of the 2 wallet balances.
Read 9 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(