From 7dc8607bfa4e09c5ce68ebf88eb6d4a26c90752e Mon Sep 17 00:00:00 2001 From: Cujowolf Date: Wed, 13 Dec 2023 12:52:18 -0600 Subject: [PATCH 1/5] Only load pools if they exist for supply percent --- projects/subgraph-bean/src/utils/Bean.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/projects/subgraph-bean/src/utils/Bean.ts b/projects/subgraph-bean/src/utils/Bean.ts index 2ed08cb28b..0d1a8c9cbe 100644 --- a/projects/subgraph-bean/src/utils/Bean.ts +++ b/projects/subgraph-bean/src/utils/Bean.ts @@ -159,16 +159,22 @@ export function getBeanTokenAddress(blockNumber: BigInt): string { export function updateBeanSupplyPegPercent(blockNumber: BigInt): void { if (blockNumber < BigInt.fromString("15278082")) { let bean = loadBean(BEAN_ERC20_V1.toHexString()); + let lpSupply = ZERO_BD; - let pool = loadOrCreatePool(BEAN_WETH_V1.toHexString(), blockNumber); - - let lpSupply = toDecimal(pool.reserves[1]); + let pool = Pool.load(BEAN_WETH_V1.toHexString()); + if (pool != null) { + lpSupply = lpSupply.plus(toDecimal(pool.reserves[1])); + } - pool = loadOrCreatePool(BEAN_3CRV_V1.toHexString(), blockNumber); - lpSupply = lpSupply.plus(toDecimal(pool.reserves[0])); + pool = Pool.load(BEAN_3CRV_V1.toHexString()); + if (pool != null) { + lpSupply = lpSupply.plus(toDecimal(pool.reserves[0])); + } - pool = loadOrCreatePool(BEAN_LUSD_V1.toHexString(), blockNumber); - lpSupply = lpSupply.plus(toDecimal(pool.reserves[0])); + pool = Pool.load(BEAN_LUSD_V1.toHexString()); + if (pool != null) { + lpSupply = lpSupply.plus(toDecimal(pool.reserves[0])); + } bean.supplyInPegLP = lpSupply.div(toDecimal(bean.supply)); bean.save(); From b3b1dadbb926020eb4e1575cb52d6d11cc6c0f29 Mon Sep 17 00:00:00 2001 From: Cujowolf Date: Wed, 13 Dec 2023 12:52:54 -0600 Subject: [PATCH 2/5] Correct pool value being updated for pool cross checks --- projects/subgraph-bean/src/utils/Cross.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/subgraph-bean/src/utils/Cross.ts b/projects/subgraph-bean/src/utils/Cross.ts index 271f32c395..da68b301ed 100644 --- a/projects/subgraph-bean/src/utils/Cross.ts +++ b/projects/subgraph-bean/src/utils/Cross.ts @@ -47,8 +47,8 @@ export function checkPoolCross(pool: string, timestamp: BigInt, blockNumber: Big let poolInfo = loadOrCreatePool(pool, blockNumber); let token = poolInfo.bean; let bean = loadBean(token); - let poolHourly = loadOrCreatePoolHourlySnapshot(token, timestamp, BigInt.fromI32(bean.lastSeason)); - let poolDaily = loadOrCreatePoolDailySnapshot(token, timestamp, blockNumber); + let poolHourly = loadOrCreatePoolHourlySnapshot(pool, timestamp, BigInt.fromI32(bean.lastSeason)); + let poolDaily = loadOrCreatePoolDailySnapshot(pool, timestamp, blockNumber); if (oldPrice >= ONE_BD && newPrice < ONE_BD) { let cross = loadOrCreatePoolCross(poolInfo.crosses, pool, timestamp); From 6da9816294a3f5ca4f94292fd71f2572434cd243 Mon Sep 17 00:00:00 2001 From: spacebean Date: Thu, 14 Dec 2023 12:00:52 -0700 Subject: [PATCH 3/5] fix home height + fix connect wallet disabled --- .../src/components/ConnectWalletButton.tsx | 20 +++++++++++++++++++ .../src/components/Liquidity/AddLiquidity.tsx | 3 ++- .../components/Liquidity/RemoveLiquidity.tsx | 4 ++-- .../dex-ui/src/components/Swap/SwapRoot.tsx | 7 +++---- projects/dex-ui/src/pages/Home.tsx | 6 +++++- 5 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 projects/dex-ui/src/components/ConnectWalletButton.tsx diff --git a/projects/dex-ui/src/components/ConnectWalletButton.tsx b/projects/dex-ui/src/components/ConnectWalletButton.tsx new file mode 100644 index 0000000000..d7cc6f2d9e --- /dev/null +++ b/projects/dex-ui/src/components/ConnectWalletButton.tsx @@ -0,0 +1,20 @@ +import { ConnectKitButton } from "connectkit"; +import React, { ComponentProps } from "react"; +import { Button } from "src/components/Swap/Button"; +import { useAccount } from "wagmi"; + +type ActionWalletButtonProps = ComponentProps; + +export const ActionWalletButton = (props: ActionWalletButtonProps) => { + const { address } = useAccount(); + + return !address ? ( + + {({ show }) => { + return