watcher-ts/packages/uniswap/contract.md
Ashwin Phatak d5608f637a
Aggregation in entities (#109)
* Analyse entity aggregations in uniswap subgraph.

* Analyse entity aggregation for Day data and Hour data entities.

* Design notes.

* Reorg, split analysis files.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-06-30 17:16:50 +05:30

2.7 KiB

Contract Analysis

View Methods in Uniswap V3 Core

Mapping Event handlers in Uniswap subgraph

  • handlePoolCreated (Factory contract - PoolCreated event)

    • Data from event
    • Entities
      • Factory
      • Bundle
      • Pool
      • Token
    • Contract calls
      • ERC20 (symbol, name, totalSupply, decimals)
      • ERC20SymbolBytes (symbol)
      • ERC20NameBytes (name)
    • Create new Template contract (Pool)
  • NonfungiblePositionManager contract

    • Handlers (Similar code)
      • handleIncreaseLiquidity (IncreaseLiquidity event)
      • handleDecreaseLiquidity (DecreaseLiquidity event)
      • handleCollect (Collect event)
      • handleTransfer (Transfer event)
    • Data from event
    • Entities
      • Position
      • Transaction
      • Token
    • Contract calls
      • NonfungiblePositionManager (positions)
      • Factory (getPool)
  • handleInitialize (Pool contract - Initialize event)

    • Data from event
    • Entities
      • Pool
      • Token
      • Bundle
      • PoolDayData
      • PoolHourData
  • handleSwap (Pool contract - Swap event)

    • Data from event
    • Entities
      • Bundle
      • Factory
      • Pool
      • Token
      • Transaction
      • Swap
      • UniswapDayData
      • PoolDayData
      • PoolHourData
      • TokenDayData
      • TokenHourData
    • Contract calls
      • Pool (feeGrowthGlobal0X128, feeGrowthGlobal1X128)
  • handleMint (Pool contract - Mint event)

    • Data from event
    • Entities
      • Bundle
      • Pool
      • Factory
      • Token
      • Transaction
      • Mint
      • Tick
      • UniswapDayData
      • PoolDayData
      • PoolHourData
      • TokenDayData
      • TokenHourData
  • handleBurn (Pool contract - Burn event)

    • Data from event
    • Entities
      • Bundle
      • Pool
      • Factory
      • Token
      • Burn
      • Tick
      • UniswapDayData
      • PoolDayData
      • PoolHourData
      • TokenDayData
      • TokenHourData
    • Extra methods
      • store.remove (remove Tick entity)