From 92446cf673aff2b6cec7f5f8ce5de9a0ba3658c4 Mon Sep 17 00:00:00 2001 From: EmberSpirit007 <148816965+EmberSpirit007@users.noreply.github.com> Date: Sat, 22 Feb 2025 10:19:10 +0100 Subject: [PATCH] set inital harbTotalSupply value --- subgraph/base_sepolia/deploy.js | 8 ++++++++ subgraph/base_sepolia/src/harb.ts | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/subgraph/base_sepolia/deploy.js b/subgraph/base_sepolia/deploy.js index 35939b3..1d4c22c 100644 --- a/subgraph/base_sepolia/deploy.js +++ b/subgraph/base_sepolia/deploy.js @@ -26,6 +26,14 @@ const networks = { // START_BLOCK: 25895309, SUBGRAPH_NAME: "kraiken-base" }, + 'base2': { + NETWORK: 'base', + CONTRACT_ADDRESS_HARB: '0x45caa5929f6ee038039984205bdecf968b954820', + CONTRACT_ADDRESS_STAKE: '0xed70707fab05d973ad41eae8d17e2bcd36192cfc', + START_BLOCK: 26038614, + // START_BLOCK: 25895309, + SUBGRAPH_NAME: "kraiken-base-test" + }, }; // Netzwerk über Kommandozeilenargument auswählen diff --git a/subgraph/base_sepolia/src/harb.ts b/subgraph/base_sepolia/src/harb.ts index 05793ef..271b622 100644 --- a/subgraph/base_sepolia/src/harb.ts +++ b/subgraph/base_sepolia/src/harb.ts @@ -6,6 +6,7 @@ import { } from "../generated/Harb/Harb"; import { BigInt, Bytes, ethereum, Address, log } from "@graphprotocol/graph-ts"; import { Stats } from "../generated/schema"; +import { getSubgraphConfig } from './chains'; let stakeTotalSupply: BigInt = BigInt.fromString("10000000000000000000000000"); @@ -13,8 +14,13 @@ let stakeTotalSupply: BigInt = BigInt.fromString("10000000000000000000000000"); function getOrCreateStats(): Stats { let stats = Stats.load(Bytes.fromHexString("0x01") as Bytes); if (stats == null) { + log.info("Stats not found, creating a new one", []); stats = new Stats(Bytes.fromHexString("0x01") as Bytes); - stats.harbTotalSupply = BigInt.zero(); + let harb = Harb.bind(getSubgraphConfig().harbergAddress); + + + + stats.harbTotalSupply = harb.totalSupply(); stats.stakeTotalSupply = stakeTotalSupply; stats.outstandingStake = BigInt.zero(); @@ -48,8 +54,6 @@ export function handleTransfer(event: TransferEvent): void { // Get a copy of the ring buffer let ringBuffer = stats.ringBuffer; - const harberg = Harb.bind(event.address); - if (event.params.from == TAX_POOL_ADDR) { // Add the UBI amount to the current hour's total in the ring buffer