From 0d583fc4c5239f4f59534414e4ae60b781402933 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Fri, 28 Jul 2023 16:27:32 -0400 Subject: [PATCH 1/2] associate bucket with Pool entity --- schema.graphql | 4 ++-- src/utils/pool/bucket.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/schema.graphql b/schema.graphql index f265128..0fc88d3 100644 --- a/schema.graphql +++ b/schema.graphql @@ -123,8 +123,8 @@ type Bucket @entity { bucketPrice: BigDecimal! # current exchange rate of the bucket exchangeRate: BigDecimal! - # pool address - poolAddress: String! + # pool in which the bucket belongs + pool: Pool! # total collateral available in the bucket collateral: BigDecimal! # total quote tokens deposited in the bucket, inclusive of interest diff --git a/src/utils/pool/bucket.ts b/src/utils/pool/bucket.ts index 590db22..d3a8722 100644 --- a/src/utils/pool/bucket.ts +++ b/src/utils/pool/bucket.ts @@ -55,7 +55,7 @@ export function loadOrCreateBucket(poolId: Bytes, bucketId: Bytes, index: u32): bucket.bucketIndex = index bucket.bucketPrice = indexToPrice(index) - bucket.poolAddress = poolId.toHexString() + bucket.pool = poolId bucket.collateral = ZERO_BD bucket.deposit = ZERO_BD bucket.exchangeRate = ONE_BD From 08c6f996a7fdc80055eb481486056dd7fac38ab4 Mon Sep 17 00:00:00 2001 From: Ed Noepel Date: Wed, 2 Aug 2023 09:37:32 -0400 Subject: [PATCH 2/2] re-added poolAddress for query filtering --- schema.graphql | 2 ++ src/utils/pool/bucket.ts | 1 + 2 files changed, 3 insertions(+) diff --git a/schema.graphql b/schema.graphql index 0fc88d3..65ce03b 100644 --- a/schema.graphql +++ b/schema.graphql @@ -123,6 +123,8 @@ type Bucket @entity { bucketPrice: BigDecimal! # current exchange rate of the bucket exchangeRate: BigDecimal! + # pool address + poolAddress: String! # pool in which the bucket belongs pool: Pool! # total collateral available in the bucket diff --git a/src/utils/pool/bucket.ts b/src/utils/pool/bucket.ts index d3a8722..87c2af0 100644 --- a/src/utils/pool/bucket.ts +++ b/src/utils/pool/bucket.ts @@ -55,6 +55,7 @@ export function loadOrCreateBucket(poolId: Bytes, bucketId: Bytes, index: u32): bucket.bucketIndex = index bucket.bucketPrice = indexToPrice(index) + bucket.poolAddress = poolId.toHexString() bucket.pool = poolId bucket.collateral = ZERO_BD bucket.deposit = ZERO_BD