CenturionDEX
Launch App

core.ts

Last modified:

path: /src/mappings/core.ts

handleInitialize()

Params:
 - event (initialize): entity of the initialize event emitted in a pool contract
 
ReturnType: void

Eth Mainnet

Entities

  1. Pool - Read & Write
  2. Token - Write
  3. Bundle - Write

Dependencies:

  1. updatePoolDayData()
  2. updatePoolHourData()
  3. getEthPriceInUSD()
  4. findEthPerToken()

Invoked at:

  1. Initialize Event (Handler)

Polygon, Optimism

Arbitrum-One

handleMint()

Params:
 - event (MintEvent): entity of the initialize event emitted in a pool contract
 
ReturnType: void

Entities

  1. Bundle - Read
  2. Pool - Read & Write
  3. Token - Read & Write
  4. Factory - Read & Write
  5. Tick - Read/Create & Write
  6. Mint - Create & Write

Dependencies:

  1. FACTORY_ADDRESS
  2. convertTokenToDecimal()
  3. loadTransaction()
  4. createTick()
  5. updateCenturionDayData()
  6. updatePoolDayData()
  7. updatePoolHourData()
  8. updateTokenDayData()
  9. updateTokenHourData()
  10. updateTickFeeVarsAndSave()
  11. ONE_BI

Invoked at:

  1. Mint Event (Handler)

handleBurn()

Params:
 - event (BurnEvent): entity of the burn event emitted in a pool contract
 
ReturnType: void

Other-Chains

Entities

  1. Bundle - Read
  2. Pool - Read & Write
  3. Token - Read & Write
  4. Factory - Read & Write
  5. Tick - Read & Write
  6. Burn - Create & Write

Dependencies:

  1. FACTORY_ADDRESS
  2. convertTokenToDecimal()
  3. loadTransaction()
  4. ONE_BI
  5. updateCenturionDayData()
  6. updatePoolDayData()
  7. updatePoolHourData()
  8. updateTokenDayData()
  9. updateTokenHourData()
  10. updateTickFeeVarsAndSave()

Invoked at:

  1. Burn Event (Handler)

Optimism

Most of the logic is same as mainnet subgraph with following changes:

Additional Dependencies

  1. createTickBurn()

handleSwap()

Params:
 - event (SwapEvent): entity of the swap event emitted in a pool contract
 
ReturnType: void

Ignored Pool The following pool address is ignored by the function: 0x9663f2ca0454accad3e094448ea6f77443880454 (WETH-LUSD)

Eth Mainnet

Entities

  1. Bundle - Read & Write
  2. Pool - Read & Write
  3. Token - Read & Write
  4. Factory - Read & Write
  5. Tick - Read/Create & Write
  6. Swap - Create & Write
  7. CenturionDayData - Write
  8. PoolDayData - Write
  9. PoolHourData - Write
  10. TokenDayData - Write
  11. TokenHourData - Write

ABI Dependencies:

  1. pool.json

Dependencies:

  1. FACTORY_ADDRESS
  2. convertTokenToDecimal()
  3. loadTransaction()
  4. getTrackedAmountUSD()
  5. safeDiv()
  6. sqrtPriceX96ToTokenPrices()
  7. getEthPriceInUSD()
  8. findEthPerToken()
  9. updateCenturionDayData()
  10. updatePoolDayData()
  11. updatePoolHourData()
  12. updateTokenDayData()
  13. updateTokenHourData()
  14. loadTickUpdateFeeVarsAndSave()
  15. feeTierToTickSpacing()
  16. ZERO_BD
  17. ZERO_BI
  18. ONE_BI

Invoked at:

  1. Swap Event (Handler)

Polygon

Arbitrum-One

handleFlash()

Params:
 - event (FlashEvent): entity of the flash event emitted in a pool contract
 
ReturnType: void

Eth Mainnet, Polygon

Entities

  1. Pool - Read & Write

ABI Dependencies:

  1. pool.json

Invoked at:

  1. Flash Event (Handler)

Arbitrum-One

updateTickFeeVarsAndSave()

Params:
 - tick (Tick): Fee Variables are updated for this tick entity
 - event (Ethereum.event): An event from the pool the tick represent is in
 
ReturnType: void

Eth Mainnet, Polygon

Entities

  1. Tick - Write

ABI Dependencies:

  1. pool.json

Dependencies:

  1. updateTickDayData()

Invoked at:

  1. handleMint()
  2. handleBurn()
  3. loadTickUpdateFeeVarsAndSave

Arbitrum-One

loadTickUpdateFeeVarsAndSave()

Params:
 - tickId (i32): The fee variables are updated for this tickId
 - event (ethereum.event): An event from the pool contract which the tick is a part of.
 
ReturnType: void

Entities

  1. Tick - Read & Write

Dependencies:

  1. updateTickFeeVarsAndSave()

Invoked at:

  1. handleSwap()