-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle increase liquidity event (#143)
* Implement handler for NFPM IncreaseLiquidity event. * Get contract values by querying uni-watcher. Co-authored-by: nabarun <[email protected]>
- Loading branch information
1 parent
ae13edb
commit 3477366
Showing
16 changed files
with
2,573 additions
and
1,376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { Entity, PrimaryColumn, Column, ManyToOne } from 'typeorm'; | ||
import Decimal from 'decimal.js'; | ||
import { decimalTransformer } from '@vulcanize/util'; | ||
|
||
import { Pool } from './Pool'; | ||
import { Token } from './Token'; | ||
import { Tick } from './Tick'; | ||
import { Transaction } from './Transaction'; | ||
import { ADDRESS_ZERO } from '../utils/constants'; | ||
|
||
@Entity() | ||
export class Position { | ||
@PrimaryColumn('varchar') | ||
id!: string; | ||
|
||
@PrimaryColumn('integer') | ||
blockNumber!: number; | ||
|
||
@Column('bigint') | ||
feeGrowthInside0LastX128!: bigint | ||
|
||
@Column('bigint') | ||
feeGrowthInside1LastX128!: bigint | ||
|
||
@Column('bigint', { default: BigInt(0) }) | ||
liquidity!: bigint | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
depositedToken0!: Decimal | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
depositedToken1!: Decimal | ||
|
||
@Column('varchar', { length: 42, default: ADDRESS_ZERO }) | ||
owner!: string | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
withdrawnToken0!: Decimal | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
withdrawnToken1!: Decimal | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
collectedFeesToken0!: Decimal | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
collectedFeesToken1!: Decimal | ||
|
||
@ManyToOne(() => Pool) | ||
pool!: Pool | ||
|
||
@ManyToOne(() => Token) | ||
token0!: Token | ||
|
||
@ManyToOne(() => Token) | ||
token1!: Token | ||
|
||
@ManyToOne(() => Tick) | ||
tickLower!: Tick | ||
|
||
@ManyToOne(() => Tick) | ||
tickUpper!: Tick | ||
|
||
@ManyToOne(() => Transaction) | ||
transaction!: Transaction | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Entity, PrimaryColumn, Column, ManyToOne } from 'typeorm'; | ||
import Decimal from 'decimal.js'; | ||
import { decimalTransformer } from '@vulcanize/util'; | ||
|
||
import { Pool } from './Pool'; | ||
import { Transaction } from './Transaction'; | ||
import { ADDRESS_ZERO } from '../utils/constants'; | ||
import { Position } from './Position'; | ||
|
||
@Entity() | ||
export class PositionSnapshot { | ||
@PrimaryColumn('varchar') | ||
id!: string; | ||
|
||
@PrimaryColumn('integer') | ||
blockNumber!: number; | ||
|
||
@Column('bigint') | ||
timestamp!: BigInt; | ||
|
||
@Column('bigint') | ||
feeGrowthInside0LastX128!: bigint | ||
|
||
@Column('bigint') | ||
feeGrowthInside1LastX128!: bigint | ||
|
||
@Column('bigint', { default: BigInt(0) }) | ||
liquidity!: bigint | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
depositedToken0!: Decimal | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
depositedToken1!: Decimal | ||
|
||
@Column('varchar', { length: 42, default: ADDRESS_ZERO }) | ||
owner!: string | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
withdrawnToken0!: Decimal | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
withdrawnToken1!: Decimal | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
collectedFeesToken0!: Decimal | ||
|
||
@Column('numeric', { default: 0, transformer: decimalTransformer }) | ||
collectedFeesToken1!: Decimal | ||
|
||
@ManyToOne(() => Pool) | ||
pool!: Pool | ||
|
||
@ManyToOne(() => Position) | ||
position!: Position | ||
|
||
@ManyToOne(() => Transaction) | ||
transaction!: Transaction | ||
} |
Oops, something went wrong.