🧬
Head First DeFi: TX & Strategies
  • Decoding the DNA of DeFi Transactions & Strategies
    • From Arbitrage, Sandwich to JIT and Oracle Manipulation
    • Be Prepared To Explore the DeFi World
    • Case Study Format
  • MEV Transaction & Strategy 101
    • A $3.2 Million Profit Arbitrage, the Most Lucrative MEV of 2022
    • Understand Back-Run Arbitrages and Their Signals and Join the MEV Game.
    • Wallchain's MEV Arbitrage Redistribution
    • MEV Blocker, the multi-transaction MEV redistribution system that refunds 90% of builder rewards
    • With NFT arbitrage, someone was snipping your Baby Doge.
    • The Hidden Tax That You Should Know About
    • MEV-Share, Flashbots' MEV Redistribution Solution
  • Don't Let Your Trading Become the Recipe of Someone's Sandwich
    • The Notorious Jaredfromsubway.eth's Sandwich Attack
    • Combined with Flash Loan, This Leveraged Sandwich Launched the Attack with Millions of Volumes
    • Sandwich Targeting Liquidity Providers
    • The Flash-Loan-Enabled Sandwich Attack against Ethereum Foundation
  • Under the Hood of the DeFi Lego
    • What's Really Going on When Processing Liquidity in a Uniswap Pool?
      • Pretend You Are One of the Shareholders of a Bank Branch.
      • Let's Match the Bank Branch to a Uniswap Pool.
      • Adding Liquidity.
      • Removing Liquidity.
      • Conclusion
    • Liquidation: A Good Entry Point to Comprehend Internal Accounting Used by Many DeFi Protocols.
    • A Cross-Chain Arbitrage: The Art of Arbitraging BANANA Cross BSC and Polygon Chains
    • Liquidity Rebalancing: Moving Around $9.4 Million for More Fee Revenues.
    • Rebalancing loan positions utilizing AAVE Flash loan
    • How Does the Grok Token Exploiter Exploit the X Token By Baking His Own Cake And Eating it?
  • Unlocking the Power of Advanced DeFi Transactions and Becoming a DeFi Sleuth
    • Just-in-Time, an MEV Type That Benefits Traders in the Same Trading Venue
    • A Bot Devised Arbitrage Strategies Centered on Autonomous Minting and Burning of Synthetic Tokens
    • The Defect in a Lending Protocol's Oracle Module Was Exploited by a Bot to Generate a $110K Profit
    • A $296K-Profit Arbitrage Done by the Lightning Reflex Bot After the Vyper-Curve Exploit
    • Coffeebabe.eth Utilized Curve's CRV/WETH Pool's Price Deviation for a $5.4 Million Profit Arbitrage.
    • An Attacker Baited MEV Arbitrage Bots and Emptied Their Wallets
    • How Enso Solves 73.5ETH in 116 Steps in One Transaction
Powered by GitBook
On this page

Was this helpful?

  1. Under the Hood of the DeFi Lego
  2. What's Really Going on When Processing Liquidity in a Uniswap Pool?

Pretend You Are One of the Shareholders of a Bank Branch.

PreviousWhat's Really Going on When Processing Liquidity in a Uniswap Pool?NextLet's Match the Bank Branch to a Uniswap Pool.

Last updated 1 year ago

Was this helpful?

First, take a look at the table below, which contains the information that concerns your interests when you become one of the shareholders of the branch.

  • You put USD and CAD(Canadian dollars) into the branch. In return, you receive shares of the branch.

  • The bank's database has internal data to store how many USD and CAD this branch owns, marked as "Internal USD" and "Internal CAD."

  • Meanwhile, to keep your record right, the bank's database also shows how much USD and CAD you have put into the bank, marked as "External USD" and "External CAD."

  • The bank branch has the data of the total shares of this branch, marked as "Entire Liquidity Share."

  • Your shares of the branch are recorded as "Shareholder's Share."

  • Now, when you put your USD and CAD assets into the bank branch as your contribution to the liquidity share of the branch, the amount of your contribution will be reflected as follows:

    • The amount of Internal USD will increase, adding your USD contribution.

    • The amount of Internal CAD will increase, adding your CAD contribution.

    • The amount of External USD is your USD contribution.

    • The amount of External CAD is your CAD contribution.

    • The number of Entire Liquidity Shares will increase, adding your shares based on your USD and CAD contribution.

    • The number of the Shareholder's Shares will increase, adding your shares based on your USD and CAD contributions.

    • All the operations above will generate an "adding" record of the internal bookkeeping for each operation.

  • Let's consider what happens when you remove your USD and CAD assets from the bank branch's overall shares. The amount of your removal will be reflected as follows:

    • The amount of Internal USD will decrease, removing your USD contribution.

    • The amount of Internal CAD will decrease, removing your CAD contribution.

    • The amount of External USD is your USD removal.

    • The amount of External CAD is your CAD removal.

    • The number of Entire Liquidity Shares will decrease, removing your shares based on your USD and CAD removals.

    • The number of Shareholder's Shares will be your shares based on your USD and CAD removals.

    • All the operations above will generate a "removing" record of the internal bookkeeping for each operation.