GEE-yohm LAMB-bear Profile picture
Oct 16, 2022 19 tweets 7 min read Read on X
Thanks for the many people that reached out about this brainteaser, it is now time for me to post the solutions :)

It turns out the solution is an integral part of how @Panoptic_xyz tracks options NFTs

what does 28253706383254293962.... have to to with NFTs ??

Thread👇
1/16
(TL;DR) It is really encoding for a ETH-SHIB Reverse Jade Lizard as hinted (!)

We'll show below how it encodes for:

• 1 long put @ 7509 x 10^-12
• 1 short put @ 8070 x 10^-12
• 1 short call @ 8936 x 10^-12
2/ So first of all, let's get back to how positions are tracked by the UniswapV3Pool.sol smart contract

Any liquidity deployed by 𝚘𝚠𝚗𝚎𝚛 between a 𝚝𝚒𝚌𝚔𝙻𝚘𝚠𝚎𝚛 and 𝚝𝚒𝚌𝚔𝚄𝚙𝚙𝚎𝚛 is stored in a mapping defined by the keccak256 hash of (owner, tickLower, tickUpper)
2/ The hash returns a struct that stores several quantities, including the liquidity owned by the user.

The struct also contains information about the fees accumulated and the tokens owed to owner when the position was last touched.
3/ However, users do not directly interact with the UniswapV3Pool smart contracts.

Instead, they will mint a position by directly interacting with the NonFungiblePositionManager.sol smart contract.

The NFPM contract helps track liquidity and issues a ERC721 NFT to the minter.
4/ The minter receives a cool on-chain generated NFT that can be seen on the app.uniswap.org website.

Also, each NFT position has a unique 𝚝𝚘𝚔𝚎𝚗𝙸𝚍, which increases *sequentially* at every mint --look at the (𝚝𝚘𝚔𝚎𝚗𝙸𝚍 = _𝚗𝚎𝚡𝚝𝙸𝚍++) in the code above.
5/ In @Panoptic_xyz, users sell options by adding liquidity in a Uni v3 pool, and buy options by removing liquidity from the pool

Panoptic users "bypass" the NFPM and use instead the SemiFungiblePositionManager.sol to trade options

LPs can still use either for "vanilla" LPing
6/ One key distinction between the NFPM and the SFPM is that the SFPM issues an ERC1155 token to track users' positions.

The balance of the ERC1155 represents the amount of liquidity for that position, we call that the 𝚙𝚘𝚜𝚒𝚝𝚒𝚘𝚗𝚂𝚒𝚣𝚎.
7/ The 256bit 𝚝𝚘𝚔𝚎𝚗𝙸𝚍 of the ERC1155 position is also different: it is not sequential, but instead encodes information about the position.

It turns out that a *lot* of information can be encoded in 256bits.
8/ Back to the riddle: 282537063832542939627736618700216160083437754282540792586635888

What is encoded in that number?

First, let's look at it as a hex:
AFD2C04800AFD2808200AFD253870111
2F62F2B4C5FCD7570A70 -< 𝚙𝚘𝚘𝚕𝙸𝚍

The last 80 bits is the 𝚙𝚘𝚘𝚕𝙸𝚍
9/ The 𝚙𝚘𝚘𝚕𝙸𝚍 is the first 20 characters of the Uniswap v3 pool, and in this case, that's the SHIB-ETH-30bps, whose address is:

0x2F62f2B4c5fcd7570a709DeC05D68EA19c82A9ec
-> first 20 characters

etherscan.io/address/0x2f62…
10/ So this tokenId is for a position in the SHIB-ETH-30bps pool.

What about the rest of the tokenId? Converting the rest to binary, we get:

10101111110100101100000001001000000000001010111111010010100000001000001000000000101011111101001001010011100001110000000100010001
11/ From the map, we know there is 16 bits for "Ratios", and each option leg is 40 bits:

ratios (4x4bits):
0000000100010001
leg0 (1x40bits):
0000000010101111110100100101001110000111
leg1:
0000000010101111110100101000000010000010
leg2:
10101111110100101100000001001000
12/ The ratios are all 1 for each leg: the position mints 1 option for each leg.

Let's unwrap Leg0: this one corresponds to a long put at strike -187080.
13/ Similarly, upwrapping Leg1 we get that it encodes for a short put at strike -186360

Leg2 encodes for a short call at strike -185340

Each leg also has a "width" of 10, which means each LP positions is 30*10 ticks wide.
14/ So, 28253706383... encodes for a specific, multi-legged option position

Decoding it revealed that it consists of a long put, a short put, and a short call in the ETH-SHIB 30bps pool.
15/ Why track position that way?

The key here is that users can 1) track complex positions using a single number and 2) they will receive a number of ERC1155 token that corresponds to the amount of liquidity deployed in that position.
16/ This also means a 4626 vault could easily be created for any options strategy

Simply point the vault to the 2825370... tokenId and all added liquidity will be automatically deployed as a Reverse Jade Lizard in the Uni v3 pool

That tokenId could also be updated over time 👀
Stay tuned for more updates about THE perpetual, oracle-free options protocol, and don't forget to follow @Panoptic_xyz for updates, AMAs, alpha leaks, and much more!

• • •

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

Keep Current with GEE-yohm LAMB-bear

GEE-yohm LAMB-bear 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 @guil_lambert

Jan 31
The current Uniswap UX for LPs is at a weird intersection: too complex for passive LPs and yet not feature rich enough for active LPs.

In my view, we need a separate protocol for each role —ie. we need active-passive LP separation.

Hasn’t this been tried before? Not quite👇
While several protocols have released univ3 managed liquidity vaults, such products still rely on a single (or a few) managers to handle the fund’s deployment/rebalancing.

Like most vault products, however, using a single strategy for all the funds leaves little room for error.
Even if the vault strategies find a way to perfectly optimize the entry-exit points, a single bad trade means that everyone suffers.

LPing is risky, and passive LPs should not be exposed to the same risks as active LPs.
Read 11 tweets
Aug 5, 2023
"LPs in UniV3 are losing millions per year. Don’t LP unless you’re a pro!”

As a retail level LP, this hasn’t been my experience at all; once I realized LPing is like selling options, it got much easier to LP successfully.

Let’s use options to demystify IL/LVR/JIT/MEV

A 🧵 Image
First: Impermanent loss (IL)

IL was originally used to compare returns of LPing in Uni v2 with those of simply holding the assets separately.

IL is simply gamma risk: it's the accelerating risk of assets conversion away from the initial 50:50 ratio. Image
How can you think like an options trader and solve IL/gamma risk?

1) buy options to transform naked positions into spreads
2) keep track and neutralize your delta+gamma
3) trade wide positions so pin risk is limited
Read 18 tweets
Jan 6, 2023
#ResearchBites from the @Panoptic_xyz team.

============
One of the core assumptions behind financial models is that prices follow a geometric brownian motion (GBM) --eg. Black-Scholes.

Does the price of the most traded asset in Uniswap v3 also follow a GBM?

Let's find out! 👇 Image
We will analyze the 5, 30, and 100bps ETH-USDC UniV3 pools.

The 5bps pool gets 90% of all volume and, zooming in on the price action, appear to have a smaller "per trade impact" than the 30 and 100bps pools

What is the size distribution of the price jumps for each pool? ImageImageImage
If the price were a GBM, then the size of the price jumps would be normally distributed.

Instead, the price jumps are narrowly peaks around size~0.

They also have a kurtosis that's much larger than a normal distribution's (high kurtosis = long-tail event are more likely). ImageImageImage
Read 7 tweets
Sep 7, 2022
Providing liquidity in Uniswap v3 generates a payoff that is mathematically identical to selling a put option.

Yet, most LPs do not use the tried-and-tested strategies used by options traders.

Here are 8 tips to help Uni v3 LPs behave more like successful options sellers 👇
1/ Have directional assumptions

Is your outlook on the token bearish, neutral, bullish?

You should control the "delta" of a position by shorting the token before locking.

Use the desmos link in this post to determine your LP positions' shorted amount: Image
2/ Understand pin risk

The width of a position should match your risk tolerance. A narrow position will rapidly convert between token and ETH in a way that is similar to pin risk in options.

Use r<1.07 if active traders and 1.07 < r < 1.75 for most traders, with r=√(Pb/Pa)
Read 11 tweets
Aug 31, 2022
Providing liquidity in @Uniswap v3 can be 600x more capital efficient than on Uni v2.

However, most use a passive approach, re-adjust their position too frequently, or provide liquidity to low-yield pools.

Here are 10 tips to make your Uni v3 LPing 10x more efficient.

A 🧵:
1. Know the risks

Providing liquidity has potentially unlimited losses and capped profitability.

LPing can generate income, but returns *will* underperform simply holding when the asset appreciates.

The key is to understand that LPing = selling options:
lambert-guillaume.medium.com/uniswap-v3-lp-…
2. Choosing an asset pair

Choose an asset pair that has enough 1) volume, 2) liquidity, and 3) legitimacy.

One way to evaluate 1) & 2) is to look at the 24h fees and TVL of a pool in info.yewbow.org/#/pools

Choose any asset with >$1M TVL and >$1k in daily fee
Read 13 tweets
May 26, 2022
. @Panoptic_xyz is a perpetual, oracle-free options protocol

-Perpetual: Panoptic options never expire. This completely eliminates the need to roll options

-Oracle-free: This one makes @Panoptic_xyz much more resilient to attacks compared to other protocols.

Here's why👇
1/ Image
2/ Oracles are necessary whenever a smart contract needs to know about external (real-world) data.

"Without a reliable connection to real-world conditions, smart contracts cannot effectively serve the real-world." (docs.chain.link)
3/ Many DeFi protocols rely on @chainlink to provide secure and accurate data about the price of digital assets.

In most lending protocols, for instance, oracles are necessary to ensure that an account, and by extension the whole protocol, remains solvent.
Read 16 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!

:(