Skip to content

Commit

Permalink
Save pool in handleInitialize
Browse files Browse the repository at this point in the history
  • Loading branch information
nlordell authored Jan 18, 2022
1 parent eef5b6e commit 2a2ac31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mappings/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ import {
import { createTick, feeTierToTickSpacing } from '../utils/tick'

export function handleInitialize(event: Initialize): void {
// update pool sqrt price and tick
let pool = Pool.load(event.address.toHexString())
pool.sqrtPrice = event.params.sqrtPriceX96
pool.tick = BigInt.fromI32(event.params.tick)
pool.save()

// update token prices
let token0 = Token.load(pool.token0)
let token1 = Token.load(pool.token1)
Expand Down

0 comments on commit 2a2ac31

Please sign in to comment.