title: How to understand the Uniswap V3 swap fee calculation
body: <p>i read the whitepaper and the code about uniswapv3. but i am still confused about uni-v3 swap fee calculation.</p>
  <p>i can‘t understand  3 formula</p>
  <blockquote>
  <p><code>qustion1</code> cant understand Tick struct field feeGrowthOutside(0/1)X128</p>
  </blockquote>
  <pre><code>   
      struct Info {
  
          uint256 feeGrowthOutside0X128;
          uint256 feeGrowthOutside1X128;
  
      }
  </code></pre>
  <p>which at whitepaper is  <a href="https://i.stack.imgur.com/fUIxe.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fUIxe.jpg" alt="enter image description here" /></a></p>
  <p>if swap cross it will be</p>
  <p><a href="https://i.stack.imgur.com/gIV0S.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gIV0S.jpg" alt="enter image description here" /></a></p>
  <blockquote>
  <p><code>question2</code> cant understand above tick i and below tick i formula</p>
  </blockquote>
  <p>which at whitepaper is
  <a href="https://i.stack.imgur.com/cgPZH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cgPZH.png" alt="enter image description here" /></a></p>
  <p>i know at uniswapv3 code. when add/remove liquidity will calculate fee owned because liqudity is discrete。 but i really dont konw what 3 formula mean although i tried the fee  distribution result is right</p>