CenturionDEX
Launch App

position-manager.ts

Last modified:

File Missing The complete file is missing for arbitrum-one

path: /src/mappings/position-manager.ts

getPosition()

Params:
 - event (ethereum.Event): An event from the NFT Position Manager contract
 - tokenId (BigInt): NFT Id for the staked position
 
ReturnType: Position | null

Eth Mainnet

No Position for same Block Mint and burn In certain scenarios, the position is minted and burnt within the same block. The contract call to NonfungiblePositionManager to retrieve position data reverts in such scenarios as the position no longer exists.

Entities

  1. Position - Read/Create Without Saving

ABI Dependencies:

  1. NonfungiblePositionManager.json

Dependencies:

  1. factoryContract
  2. ZERO_BI
  3. ZERO_BD
  4. ADDRESS_ZERO
  5. loadTransaction()

Invoked at:

  1. handleIncreaseLiquidity()
  2. handleDecreaseLiquidity()
  3. handleCollect()
  4. handleTransfer()

Polygon, Optimism

In addition to mainnet:

updateFeeVars()

Params:
 - position (Position): The position for which the fee variables are set
 - event (ethereum.Event): An event from the NFT Position Manager contract
 - tokenId (BigInt): NFT Id for the staked position
 
ReturnType: Position

Entities

  1. Position - Update Fields Without Saving

ABI Dependencies:

  1. NonfungiblePositionManager.json

Invoked at:

  1. handleIncreaseLiquidity()
  2. handleDecreaseLiquidity()
  3. handleCollect()

savePositionSnapshot()

Params:
 - position (Position): Position entity for which the current state is saved as a snapshot
 - event (ethereum.Event): NonfungiblePositionManager Contract event after which the snapshot is being saved
 
ReturnType: void

Entities

  1. PositionSnapshot() - Create

Dependencies:

  1. loadTransaction()

Invoked at:

  1. handleIncreaseLiquidity()
  2. handleDecreaseLiquidity()
  3. handleCollect()
  4. handleTransfer()

handleIncreaseLiquidity()

Params:
 - event (IncreaseLiquidity): Entity for a IncreaseLiquidity event emitted by NonfungiblePositionManager Contract
 
ReturnType: void

Eth Mainnet

Ignored Blocks and Addresses

  • Block 14317993 is ignored by the function.
  • Pool address 0x8fe8d9bb8eeba3ed688069c3d6b556c9ca258248 (MULAN-USDT) is ignored by the function.

Entities

  1. Position - Write
  2. Token - Read

Dependencies:

  1. getPosition()
  2. convertTokenToDecimal()
  3. updateFeeVars()
  4. savePositionSnapshot()

Invoked at:

  1. IncreaseLiquidity Event (Handler)

Polygon

Follows most of the logic of mainnet except the following points:

Additional Entities Referenced

  1. Bundle - Read

Optimism

Follows most of the logic of mainnet except the following points:

Additional Entities Referenced

  1. Bundle - Read

handleDecreaseLiquidity()

Params:
 - event (DecreaseLiquidity): Entity for a DecreaseLiquidity event emitted by NonfungiblePositionManager Contract
 
ReturnType: void

Eth Mainnet

Ignored Blocks and Addresses

  • Block 14317993 is ignored by the function.
  • Pool address 0x8fe8d9bb8eeba3ed688069c3d6b556c9ca258248 (MULAN-USDT) is ignored by the function.

Entities

  1. Position - Write
  2. Token - Read

Dependencies:

  1. getPosition()
  2. convertTokenToDecimal()
  3. updateFeeVars()
  4. savePositionSnapshot()

Invoked at:

  1. DecreaseLiquidity Event (Handler)

Polygon

Follows most of the logic of mainnet except the following points:

Additional Entities

  1. Bundle - Read

Optimism

Follows most of the logic of mainnet except the following points:

Additional Entities Referenced

  1. Bundle - Read

handleCollect()

Params:
 - event (Collect): Entity for a Collect event emitted by NonfungiblePositionManager Contract
 
ReturnType: void

Ignored Addresses

  • Pool address 0x8fe8d9bb8eeba3ed688069c3d6b556c9ca258248 (MULAN-USDT) is ignored by the function.

Eth Mainnet

Incorrect Collected Fees Token1 amount event.params.amount0 (adjusted with token0.decimals) is added to both position.collectedFeesToken0 and position.collectedFeesToken1. This logic needs to be validated.

Entities

  1. Position - Write
  2. Token - Read

Dependencies:

  1. getPosition()
  2. convertTokenToDecimal()
  3. updateFeeVars()
  4. savePositionSnapshot()

Invoked at:

  1. Collect Event (Handler)

Polygon

Differs from mainnet at the following areas:

Additional Entities

  1. Bundle - Read

Optimism

Differs from mainnet at the following areas:

Additional Entities Referenced

  1. Bundle - Read

handleTransfer()

Params:
 - event (Transfer): Entity for a Transfer event emitted by NonfungiblePositionManager Contract
 
ReturnType: void

Entities

  1. Position - Write

Dependencies:

  1. getPosition()
  2. savePositionSnapshot()

Invoked at:

  1. Transfer Event (Handler)