Skip to content

Commit

Permalink
Merge pull request #546 from thetroyharris/issue-185
Browse files Browse the repository at this point in the history
Issue #185 updates
  • Loading branch information
mendesfabio authored Dec 22, 2023
2 parents c7103ef + f7a8555 commit 2f55e1c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 9 additions & 5 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ type Balancer @entity {
id: ID!
poolCount: Int!
pools: [Pool!] @derivedFrom(field: "vaultID")
snapshots: [BalancerSnapshot!] @derivedFrom(field: "vault")

totalLiquidity: BigDecimal!
totalSwapCount: BigInt!
Expand All @@ -22,16 +23,16 @@ type Pool @entity {
oracleEnabled: Boolean!
symbol: String
name: String

"Indicates if a pool can be swapped against. Combines multiple sources, including offchain curation"
swapEnabled: Boolean!

"The native swapEnabled boolean. internal to the pool. Only applies to Gyro, LBPs and InvestmentPools"
swapEnabledInternal: Boolean

"External indication from an offchain permissioned actor"
swapEnabledCurationSignal: Boolean

swapFee: BigDecimal!
owner: Bytes
isPaused: Boolean
Expand All @@ -53,6 +54,7 @@ type Pool @entity {
tokensList: [Bytes!]!

tokens: [PoolToken!] @derivedFrom(field: "poolId")
joinsExits: [JoinExit!] @derivedFrom(field: "pool")
swaps: [Swap!] @derivedFrom(field: "poolId")
shares: [PoolShare!] @derivedFrom(field: "poolId")
snapshots: [PoolSnapshot!] @derivedFrom(field: "pool")
Expand Down Expand Up @@ -255,6 +257,7 @@ type Swap @entity(immutable: true) {
poolId: Pool!
userAddress: User!
timestamp: Int!
block: BigInt!
tx: Bytes!
}

Expand All @@ -273,6 +276,7 @@ type JoinExit @entity(immutable: true) {
user: User!
timestamp: Int!
tx: Bytes!
block: BigInt!
}

type LatestPrice @entity {
Expand Down Expand Up @@ -401,4 +405,4 @@ type ProtocolIdData @entity {
type FXOracle @entity {
id: ID! # FX oracle aggregator address
tokens: [Bytes!]! # token addresses using this oracle
}
}
3 changes: 3 additions & 0 deletions src/mappings/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ function handlePoolJoined(event: PoolBalanceChanged): void {
join.timestamp = blockTimestamp;
join.tx = transactionHash;
join.valueUSD = valueUSD;
join.block = event.block.number;
join.save();

let protocolFeeUSD = ZERO_BD;
Expand Down Expand Up @@ -329,6 +330,7 @@ function handlePoolExited(event: PoolBalanceChanged): void {
exit.timestamp = blockTimestamp;
exit.tx = transactionHash;
exit.valueUSD = valueUSD;
exit.block = event.block.number;
exit.save();

let protocolFeeUSD = ZERO_BD;
Expand Down Expand Up @@ -617,6 +619,7 @@ export function handleSwapEvent(event: SwapEvent): void {

swap.timestamp = blockTimestamp;
swap.tx = transactionHash;
swap.block = event.block.number;
swap.save();

// update pool swapsCount
Expand Down

0 comments on commit 2f55e1c

Please sign in to comment.